add auth docs, add eslint import/order

This commit is contained in:
andres
2023-07-16 19:44:58 +02:00
parent 0f3e89900a
commit aa7ece41a9
74 changed files with 1152 additions and 164 deletions

View File

@@ -3,6 +3,7 @@ import { omit } from 'remeda'
export const setCountKey = <K extends string, L extends string>(key: K, newKey: L) => {
return <T extends Record<string, any>>(obj: T) => {
obj[newKey] = obj['_count'][key]
return omit(obj, ['_count']) as Omit<T, '_count'> & { [P in L]: number }
}
}

View File

@@ -1,5 +1,5 @@
import { IsNumber, IsOptional } from 'class-validator'
import { Type } from 'class-transformer'
import { IsNumber, IsOptional } from 'class-validator'
export class PaginationDto {
@IsOptional()

View File

@@ -1,4 +1,5 @@
import { isObject } from 'remeda'
import { DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE } from './pagination.constants'
export class Pagination {
@@ -17,6 +18,7 @@ export class Pagination {
!isNaN(Number(query.itemsPerPage))
? +query.itemsPerPage
: DEFAULT_PAGE_SIZE
return { currentPage, itemsPerPage, ...query }
}
@@ -31,6 +33,7 @@ export class Pagination {
}
) {
const totalPages = Math.ceil(count / itemsPerPage)
return {
pagination: {
totalPages,

View File

@@ -2,5 +2,6 @@ import { createParamDecorator, ExecutionContext } from '@nestjs/common'
export const Cookies = createParamDecorator((data: string, ctx: ExecutionContext) => {
const request = ctx.switchToHttp().getRequest()
return data ? request.cookies?.[data] : request.cookies
})

View File

@@ -1,7 +1,8 @@
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3'
import { Injectable } from '@nestjs/common'
import { v4 as uuid } from 'uuid'
import { PrismaService } from '../../prisma.service'
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3'
@Injectable()
export class FileUploadService {