Skip to content

Commit fc25847

Browse files
committed
Declare EdgeDB types for resources
1 parent 7e83e14 commit fc25847

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

src/components/comments/mention-notification/comment-via-mention-notification.dto.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { ObjectType } from '@nestjs/graphql';
22
import { keys as keysOf } from 'ts-transformer-keys';
33
import { SecuredProps } from '~/common';
4-
import { LinkTo } from '~/core/resources';
4+
import { e } from '~/core/edgedb';
5+
import { LinkTo, RegisterResource } from '~/core/resources';
56
import { Notification } from '../../notifications';
67

8+
@RegisterResource({ db: e.Notification.CommentViaMention })
79
@ObjectType({
810
implements: [Notification],
911
})
@@ -14,3 +16,12 @@ export class CommentViaMentionNotification extends Notification {
1416

1517
readonly comment: LinkTo<'Comment'>;
1618
}
19+
20+
declare module '~/core/resources/map' {
21+
interface ResourceMap {
22+
CommentMentionedNotification: typeof CommentViaMentionNotification;
23+
}
24+
interface ResourceDBMap {
25+
CommentMentionedNotification: typeof e.Notification.CommentViaMention;
26+
}
27+
}

src/components/notification-system/system-notification.dto.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import { Field, ObjectType } from '@nestjs/graphql';
22
import { keys as keysOf } from 'ts-transformer-keys';
33
import { SecuredProps } from '~/common';
44
import { MarkdownScalar } from '~/common/markdown.scalar';
5+
import { RegisterResource } from '~/core';
6+
import { e } from '~/core/edgedb';
57
import { Notification } from '../notifications';
68

9+
@RegisterResource({ db: e.Notification.System })
710
@ObjectType({
811
implements: [Notification],
912
})
@@ -14,3 +17,12 @@ export class SystemNotification extends Notification {
1417
@Field(() => MarkdownScalar)
1518
readonly message: string;
1619
}
20+
21+
declare module '~/core/resources/map' {
22+
interface ResourceMap {
23+
SystemNotification: typeof SystemNotification;
24+
}
25+
interface ResourceDBMap {
26+
SystemNotification: typeof e.Notification.System;
27+
}
28+
}

src/components/notifications/dto/notification.dto.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { Field, InterfaceType } from '@nestjs/graphql';
22
import { DateTime } from 'luxon';
33
import { keys as keysOf } from 'ts-transformer-keys';
44
import { DateTimeField, Resource, SecuredProps } from '~/common';
5+
import { e } from '~/core/edgedb';
56
import { RegisterResource } from '~/core/resources';
67

7-
@RegisterResource()
8+
@RegisterResource({ db: e.default.Notification })
89
@InterfaceType({
910
implements: [Resource],
1011
})
@@ -28,7 +29,7 @@ declare module '~/core/resources/map' {
2829
interface ResourceMap {
2930
Notification: typeof Notification;
3031
}
31-
// interface ResourceDBMap {
32-
// Notification: typeof e.Notification;
33-
// }
32+
interface ResourceDBMap {
33+
Notification: typeof e.default.Notification;
34+
}
3435
}

0 commit comments

Comments
 (0)