Skip to content

Commit b1e29e1

Browse files
committed
remove important information user field
1 parent 63b6a05 commit b1e29e1

File tree

1 file changed

+2
-71
lines changed

1 file changed

+2
-71
lines changed

graphql/user/fields.ts

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ import {
99
PupilWhereInput,
1010
Log,
1111
Push_subscription as PushSubscription,
12-
Important_information,
1312
} from '../generated';
14-
import { Root, Authorized, FieldResolver, Query, Resolver, Arg, Ctx, ObjectType, Field, Int, createUnionType } from 'type-graphql';
13+
import { Root, Authorized, FieldResolver, Query, Resolver, Arg, Ctx, ObjectType, Field, Int } from 'type-graphql';
1514
import { UNAUTHENTICATED_USER, loginAsUser } from '../authentication';
1615
import { GraphQLContext } from '../context';
1716
import { Role } from '../authorizations';
@@ -21,6 +20,7 @@ import { queryUser, User, userForPupil, userForStudent } from '../../common/user
2120
import { UserType } from '../types/user';
2221
import { JSONResolver } from 'graphql-scalars';
2322
import { ACCUMULATED_LIMIT, LimitedQuery, LimitEstimated } from '../complexity';
23+
import { DEFAULT_PREFERENCES } from '../../common/notification/defaultPreferences';
2424
import { findUsers } from '../../common/user/search';
2525
import { getAppointmentsForUser, getEdgeAppointmentId, hasAppointmentsForUser } from '../../common/appointment/get';
2626
import { getMyContacts, UserContactType } from '../../common/chat/contacts';
@@ -35,7 +35,6 @@ import assert from 'assert';
3535
import { getPushSubscriptions, publicKey } from '../../common/notification/channels/push';
3636
import _ from 'lodash';
3737
import { getUserNotificationPreferences } from '../../common/notification';
38-
import { AchievementState } from '../../common/achievement/types';
3938

4039
@ObjectType()
4140
export class UserContact implements UserContactType {
@@ -58,54 +57,6 @@ export class Contact {
5857
@Field((_type) => String, { nullable: true })
5958
chatId?: string;
6059
}
61-
62-
@ObjectType()
63-
export class ImportantInformationNew {
64-
@Field((_type) => String)
65-
title: string;
66-
@Field((_type) => String)
67-
description: string;
68-
@Field((_type) => String)
69-
type: 'normal' | 'sequence';
70-
71-
@Field((_type) => Int, { nullable: true })
72-
maxSteps: number | null;
73-
@Field((_type) => Int, { nullable: true })
74-
finishedSteps: number | null;
75-
// @Field((_type) => important_information_recipients_enum)
76-
@Field((_type) => String)
77-
recipients: 'students' | 'pupils';
78-
// @Field((_type) => important_information_language_enum)
79-
@Field((_type) => String)
80-
language: 'en' | 'de';
81-
@Field((_type) => ImportantInformationModal)
82-
modal: typeof ImportantInformationModal;
83-
}
84-
85-
@ObjectType()
86-
export class ImportantInformationTextModal {
87-
@Field((_type) => String)
88-
text: string;
89-
@Field((_type) => String, { nullable: true })
90-
navigateTo: string | null;
91-
}
92-
93-
export const ImportantInformationAchievementModal = Achievement;
94-
95-
export const ImportantInformationModal = createUnionType({
96-
name: 'Modal',
97-
types: () => [ImportantInformationAchievementModal, ImportantInformationTextModal] as const,
98-
resolveType: (value) => {
99-
if ('tagline' in value) {
100-
return ImportantInformationAchievementModal;
101-
}
102-
if ('text' in value) {
103-
return ImportantInformationTextModal;
104-
}
105-
return undefined;
106-
},
107-
});
108-
10960
@Resolver((of) => UserType)
11061
export class UserFieldsResolver {
11162
@FieldResolver((returns) => String)
@@ -339,26 +290,6 @@ export class UserFieldsResolver {
339290
return await getAppointmentsForUser(user, take, skip, cursor, direction);
340291
}
341292

342-
@FieldResolver((returns) => [ImportantInformationNew])
343-
@Authorized(Role.ADMIN, Role.OWNER)
344-
async importantInformations(@Ctx() context: GraphQLContext) {
345-
const achievements = await getUserAchievements(context.user);
346-
return achievements
347-
.filter((a) => a.achievementType === 'SEQUENTIAL' && a.achievementState === AchievementState.ACTIVE)
348-
.map(
349-
(a): ImportantInformationNew => ({
350-
description: a.description,
351-
title: a.title,
352-
recipients: 'students',
353-
language: 'de',
354-
type: 'sequence',
355-
maxSteps: a.maxSteps,
356-
finishedSteps: a.currentStep,
357-
modal: a,
358-
})
359-
);
360-
}
361-
362293
@FieldResolver((returns) => Boolean)
363294
@Authorized(Role.ADMIN, Role.OWNER)
364295
async hasAppointments(@Root() user: User): Promise<boolean> {

0 commit comments

Comments
 (0)