-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into docs/database-design
- Loading branch information
Showing
11 changed files
with
246 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
apps/api/src/modules/archived-notifications/archived-notifications.resolver.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { ArchivedNotificationsResolver } from './archived-notifications.resolver'; | ||
|
||
describe('ArchivedNotificationsResolver', () => { | ||
let resolver: ArchivedNotificationsResolver; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ArchivedNotificationsResolver], | ||
}).compile(); | ||
|
||
resolver = module.get<ArchivedNotificationsResolver>(ArchivedNotificationsResolver); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(resolver).toBeDefined(); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
apps/api/src/modules/archived-notifications/archived-notifications.resolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Args, Context, Query, Resolver } from '@nestjs/graphql'; | ||
import { ArchivedNotificationsService } from './archived-notifications.service'; | ||
import { ArchivedNotification } from './entities/archived-notification.entity'; | ||
import { UseGuards } from '@nestjs/common'; | ||
import { ArchivedNotificationResponse } from './dtos/archived-notification-response.dto'; | ||
import { QueryOptionsDto } from 'src/common/graphql/dtos/query-options.dto'; | ||
import { GqlAuthGuard } from 'src/common/guards/api-key/gql-auth.guard'; | ||
|
||
@Resolver(() => ArchivedNotification) | ||
@UseGuards(GqlAuthGuard) | ||
export class ArchivedNotificationsResolver { | ||
constructor(private readonly archivedNotificationsService: ArchivedNotificationsService) {} | ||
|
||
@Query(() => ArchivedNotificationResponse, { name: 'archivedNotifications' }) | ||
async findAll( | ||
@Context() context, | ||
@Args('options', { type: () => QueryOptionsDto, nullable: true, defaultValue: {} }) | ||
options: QueryOptionsDto, | ||
): Promise<ArchivedNotificationResponse> { | ||
return this.archivedNotificationsService.getAllArchivedNotifications(options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
apps/api/src/modules/archived-notifications/dtos/archived-notification-response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ObjectType, Field, Int } from '@nestjs/graphql'; | ||
import { ArchivedNotification } from '../entities/archived-notification.entity'; | ||
|
||
@ObjectType() | ||
export class ArchivedNotificationResponse { | ||
@Field(() => [ArchivedNotification]) | ||
archivedNotifications: ArchivedNotification[]; | ||
|
||
@Field(() => Int) | ||
total: number; | ||
|
||
@Field(() => Int) | ||
offset: number; | ||
|
||
@Field(() => Int) | ||
limit: number; | ||
|
||
constructor(items: ArchivedNotification[], total: number, offset?: number, limit?: number) { | ||
this.archivedNotifications = items; | ||
this.total = total; | ||
this.offset = offset ?? 0; | ||
this.limit = limit ?? items.length; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters