|
1 | 1 | import { Args, Parent, Query, ResolveField, Resolver } from '@nestjs/graphql';
|
2 | 2 | import { stripIndent } from 'common-tags';
|
3 |
| -import { |
4 |
| - AnonSession, |
5 |
| - type ID, |
6 |
| - IdArg, |
7 |
| - ListArg, |
8 |
| - LoggedInSession, |
9 |
| - type Session, |
10 |
| -} from '~/common'; |
| 3 | +import { AnonSession, type ID, IdArg, ListArg, type Session } from '~/common'; |
| 4 | +import { loggedInSession as verifyLoggedIn } from '~/common/session'; |
11 | 5 | import { Loader, type LoaderOf, ResourceLoader } from '~/core';
|
12 | 6 | import { UserLoader } from '../user';
|
13 | 7 | import { User } from '../user/dto';
|
@@ -47,9 +41,11 @@ export class CommentThreadResolver {
|
47 | 41 | async commentThreads(
|
48 | 42 | @IdArg({ name: 'resource' }) resourceId: ID,
|
49 | 43 | @ListArg(CommentThreadListInput) input: CommentThreadListInput,
|
50 |
| - @LoggedInSession() session: Session, |
| 44 | + @AnonSession() session: Session, |
51 | 45 | @Loader(CommentThreadLoader) commentThreads: LoaderOf<CommentThreadLoader>,
|
52 | 46 | ): Promise<CommentThreadList> {
|
| 47 | + // TODO move to auth policy |
| 48 | + verifyLoggedIn(session); |
53 | 49 | const resource = await this.service.loadCommentable(resourceId);
|
54 | 50 | const list = await this.service.listThreads(resource, input, session);
|
55 | 51 | commentThreads.primeAll(list.items);
|
|
0 commit comments