chore(backend): convert basic RefreshToken model to TypeORM entity (#2401)

* chore: convert basic RefreshToken model to TypeORM entity

Co-authored-by: v1b3m <vibenjamin6@gmail.com>

* Fix import

Co-authored-by: v1b3m <vibenjamin6@gmail.com>

---------

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
This commit is contained in:
gitstart-twenty
2023-11-14 17:54:04 +05:45
committed by GitHub
parent 6eb4e00ce1
commit a69711429b
11 changed files with 262 additions and 6 deletions

View File

@ -0,0 +1,41 @@
import {
AutoResolverOpts,
PagingStrategies,
ReadResolverOpts,
} from '@ptc-org/nestjs-query-graphql';
import { SortDirection } from '@ptc-org/nestjs-query-core';
import { JwtAuthGuard } from 'src/guards/jwt.auth.guard';
import { RefreshToken } from './refresh-token.entity';
import { CreateRefreshTokenInput } from './dtos/create-refresh-token.input';
export const refreshTokenAutoResolverOpts: AutoResolverOpts<
any,
any,
unknown,
unknown,
ReadResolverOpts<any>,
PagingStrategies
>[] = [
{
EntityClass: RefreshToken,
DTOClass: RefreshToken,
CreateDTOClass: CreateRefreshTokenInput,
enableTotalCount: true,
pagingStrategy: PagingStrategies.CURSOR,
read: {
defaultSort: [{ field: 'id', direction: SortDirection.DESC }],
},
create: {
many: { disabled: true },
},
update: {
many: { disabled: true },
one: { disabled: true },
},
delete: { many: { disabled: true }, one: { disabled: true } },
guards: [JwtAuthGuard],
},
];