feat: refactor storage module (#521)
* feat: refactor storage module * fix: folder need to be kebab case * fix: comment wrong auth
This commit is contained in:
@ -9,8 +9,8 @@ export class CreateManyCommentThreadTargetArgs {
|
||||
|
||||
@Field(() => [CommentThreadTargetCreateManyInput], {nullable:false})
|
||||
@Type(() => CommentThreadTargetCreateManyInput)
|
||||
@Type(() => CommentThreadTargetCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentThreadTargetCreateManyInput)
|
||||
data!: Array<CommentThreadTargetCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOneCommentThreadTargetArgs {
|
||||
|
||||
@Field(() => CommentThreadTargetCreateInput, {nullable:false})
|
||||
@Type(() => CommentThreadTargetCreateInput)
|
||||
@Type(() => CommentThreadTargetCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentThreadTargetCreateInput)
|
||||
data!: CommentThreadTargetCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyCommentThreadTargetArgs {
|
||||
|
||||
@Field(() => CommentThreadTargetUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => CommentThreadTargetUpdateManyMutationInput)
|
||||
@Type(() => CommentThreadTargetUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentThreadTargetUpdateManyMutationInput)
|
||||
data!: CommentThreadTargetUpdateManyMutationInput;
|
||||
|
||||
@Field(() => CommentThreadTargetWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOneCommentThreadTargetArgs {
|
||||
|
||||
@Field(() => CommentThreadTargetUpdateInput, {nullable:false})
|
||||
@Type(() => CommentThreadTargetUpdateInput)
|
||||
@Type(() => CommentThreadTargetUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentThreadTargetUpdateInput)
|
||||
data!: CommentThreadTargetUpdateInput;
|
||||
|
||||
@Field(() => CommentThreadTargetWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyCommentThreadArgs {
|
||||
|
||||
@Field(() => [CommentThreadCreateManyInput], {nullable:false})
|
||||
@Type(() => CommentThreadCreateManyInput)
|
||||
@Type(() => CommentThreadCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentThreadCreateManyInput)
|
||||
data!: Array<CommentThreadCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOneCommentThreadArgs {
|
||||
|
||||
@Field(() => CommentThreadCreateInput, {nullable:false})
|
||||
@Type(() => CommentThreadCreateInput)
|
||||
@Type(() => CommentThreadCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentThreadCreateInput)
|
||||
data!: CommentThreadCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyCommentThreadArgs {
|
||||
|
||||
@Field(() => CommentThreadUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => CommentThreadUpdateManyMutationInput)
|
||||
@Type(() => CommentThreadUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentThreadUpdateManyMutationInput)
|
||||
data!: CommentThreadUpdateManyMutationInput;
|
||||
|
||||
@Field(() => CommentThreadWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOneCommentThreadArgs {
|
||||
|
||||
@Field(() => CommentThreadUpdateInput, {nullable:false})
|
||||
@Type(() => CommentThreadUpdateInput)
|
||||
@Type(() => CommentThreadUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentThreadUpdateInput)
|
||||
data!: CommentThreadUpdateInput;
|
||||
|
||||
@Field(() => CommentThreadWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyCommentArgs {
|
||||
|
||||
@Field(() => [CommentCreateManyInput], {nullable:false})
|
||||
@Type(() => CommentCreateManyInput)
|
||||
@Type(() => CommentCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentCreateManyInput)
|
||||
data!: Array<CommentCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOneCommentArgs {
|
||||
|
||||
@Field(() => CommentCreateInput, {nullable:false})
|
||||
@Type(() => CommentCreateInput)
|
||||
@Type(() => CommentCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentCreateInput)
|
||||
data!: CommentCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyCommentArgs {
|
||||
|
||||
@Field(() => CommentUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => CommentUpdateManyMutationInput)
|
||||
@Type(() => CommentUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentUpdateManyMutationInput)
|
||||
data!: CommentUpdateManyMutationInput;
|
||||
|
||||
@Field(() => CommentWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOneCommentArgs {
|
||||
|
||||
@Field(() => CommentUpdateInput, {nullable:false})
|
||||
@Type(() => CommentUpdateInput)
|
||||
@Type(() => CommentUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CommentUpdateInput)
|
||||
data!: CommentUpdateInput;
|
||||
|
||||
@Field(() => CommentWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyCompanyArgs {
|
||||
|
||||
@Field(() => [CompanyCreateManyInput], {nullable:false})
|
||||
@Type(() => CompanyCreateManyInput)
|
||||
@Type(() => CompanyCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CompanyCreateManyInput)
|
||||
data!: Array<CompanyCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOneCompanyArgs {
|
||||
|
||||
@Field(() => CompanyCreateInput, {nullable:false})
|
||||
@Type(() => CompanyCreateInput)
|
||||
@Type(() => CompanyCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CompanyCreateInput)
|
||||
data!: CompanyCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyCompanyArgs {
|
||||
|
||||
@Field(() => CompanyUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => CompanyUpdateManyMutationInput)
|
||||
@Type(() => CompanyUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CompanyUpdateManyMutationInput)
|
||||
data!: CompanyUpdateManyMutationInput;
|
||||
|
||||
@Field(() => CompanyWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOneCompanyArgs {
|
||||
|
||||
@Field(() => CompanyUpdateInput, {nullable:false})
|
||||
@Type(() => CompanyUpdateInput)
|
||||
@Type(() => CompanyUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => CompanyUpdateInput)
|
||||
data!: CompanyUpdateInput;
|
||||
|
||||
@Field(() => CompanyWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyPersonArgs {
|
||||
|
||||
@Field(() => [PersonCreateManyInput], {nullable:false})
|
||||
@Type(() => PersonCreateManyInput)
|
||||
@Type(() => PersonCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PersonCreateManyInput)
|
||||
data!: Array<PersonCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOnePersonArgs {
|
||||
|
||||
@Field(() => PersonCreateInput, {nullable:false})
|
||||
@Type(() => PersonCreateInput)
|
||||
@Type(() => PersonCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PersonCreateInput)
|
||||
data!: PersonCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyPersonArgs {
|
||||
|
||||
@Field(() => PersonUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => PersonUpdateManyMutationInput)
|
||||
@Type(() => PersonUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PersonUpdateManyMutationInput)
|
||||
data!: PersonUpdateManyMutationInput;
|
||||
|
||||
@Field(() => PersonWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOnePersonArgs {
|
||||
|
||||
@Field(() => PersonUpdateInput, {nullable:false})
|
||||
@Type(() => PersonUpdateInput)
|
||||
@Type(() => PersonUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PersonUpdateInput)
|
||||
data!: PersonUpdateInput;
|
||||
|
||||
@Field(() => PersonWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyPipelineProgressArgs {
|
||||
|
||||
@Field(() => [PipelineProgressCreateManyInput], {nullable:false})
|
||||
@Type(() => PipelineProgressCreateManyInput)
|
||||
@Type(() => PipelineProgressCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineProgressCreateManyInput)
|
||||
data!: Array<PipelineProgressCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOnePipelineProgressArgs {
|
||||
|
||||
@Field(() => PipelineProgressCreateInput, {nullable:false})
|
||||
@Type(() => PipelineProgressCreateInput)
|
||||
@Type(() => PipelineProgressCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineProgressCreateInput)
|
||||
data!: PipelineProgressCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyPipelineProgressArgs {
|
||||
|
||||
@Field(() => PipelineProgressUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => PipelineProgressUpdateManyMutationInput)
|
||||
@Type(() => PipelineProgressUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineProgressUpdateManyMutationInput)
|
||||
data!: PipelineProgressUpdateManyMutationInput;
|
||||
|
||||
@Field(() => PipelineProgressWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOnePipelineProgressArgs {
|
||||
|
||||
@Field(() => PipelineProgressUpdateInput, {nullable:false})
|
||||
@Type(() => PipelineProgressUpdateInput)
|
||||
@Type(() => PipelineProgressUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineProgressUpdateInput)
|
||||
data!: PipelineProgressUpdateInput;
|
||||
|
||||
@Field(() => PipelineProgressWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyPipelineStageArgs {
|
||||
|
||||
@Field(() => [PipelineStageCreateManyInput], {nullable:false})
|
||||
@Type(() => PipelineStageCreateManyInput)
|
||||
@Type(() => PipelineStageCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineStageCreateManyInput)
|
||||
data!: Array<PipelineStageCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOnePipelineStageArgs {
|
||||
|
||||
@Field(() => PipelineStageCreateInput, {nullable:false})
|
||||
@Type(() => PipelineStageCreateInput)
|
||||
@Type(() => PipelineStageCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineStageCreateInput)
|
||||
data!: PipelineStageCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyPipelineStageArgs {
|
||||
|
||||
@Field(() => PipelineStageUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => PipelineStageUpdateManyMutationInput)
|
||||
@Type(() => PipelineStageUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineStageUpdateManyMutationInput)
|
||||
data!: PipelineStageUpdateManyMutationInput;
|
||||
|
||||
@Field(() => PipelineStageWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOnePipelineStageArgs {
|
||||
|
||||
@Field(() => PipelineStageUpdateInput, {nullable:false})
|
||||
@Type(() => PipelineStageUpdateInput)
|
||||
@Type(() => PipelineStageUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineStageUpdateInput)
|
||||
data!: PipelineStageUpdateInput;
|
||||
|
||||
@Field(() => PipelineStageWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyPipelineArgs {
|
||||
|
||||
@Field(() => [PipelineCreateManyInput], {nullable:false})
|
||||
@Type(() => PipelineCreateManyInput)
|
||||
@Type(() => PipelineCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineCreateManyInput)
|
||||
data!: Array<PipelineCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOnePipelineArgs {
|
||||
|
||||
@Field(() => PipelineCreateInput, {nullable:false})
|
||||
@Type(() => PipelineCreateInput)
|
||||
@Type(() => PipelineCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineCreateInput)
|
||||
data!: PipelineCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyPipelineArgs {
|
||||
|
||||
@Field(() => PipelineUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => PipelineUpdateManyMutationInput)
|
||||
@Type(() => PipelineUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineUpdateManyMutationInput)
|
||||
data!: PipelineUpdateManyMutationInput;
|
||||
|
||||
@Field(() => PipelineWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOnePipelineArgs {
|
||||
|
||||
@Field(() => PipelineUpdateInput, {nullable:false})
|
||||
@Type(() => PipelineUpdateInput)
|
||||
@Type(() => PipelineUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => PipelineUpdateInput)
|
||||
data!: PipelineUpdateInput;
|
||||
|
||||
@Field(() => PipelineWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyRefreshTokenArgs {
|
||||
|
||||
@Field(() => [RefreshTokenCreateManyInput], {nullable:false})
|
||||
@Type(() => RefreshTokenCreateManyInput)
|
||||
@Type(() => RefreshTokenCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => RefreshTokenCreateManyInput)
|
||||
data!: Array<RefreshTokenCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOneRefreshTokenArgs {
|
||||
|
||||
@Field(() => RefreshTokenCreateInput, {nullable:false})
|
||||
@Type(() => RefreshTokenCreateInput)
|
||||
@Type(() => RefreshTokenCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => RefreshTokenCreateInput)
|
||||
data!: RefreshTokenCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyRefreshTokenArgs {
|
||||
|
||||
@Field(() => RefreshTokenUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => RefreshTokenUpdateManyMutationInput)
|
||||
@Type(() => RefreshTokenUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => RefreshTokenUpdateManyMutationInput)
|
||||
data!: RefreshTokenUpdateManyMutationInput;
|
||||
|
||||
@Field(() => RefreshTokenWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOneRefreshTokenArgs {
|
||||
|
||||
@Field(() => RefreshTokenUpdateInput, {nullable:false})
|
||||
@Type(() => RefreshTokenUpdateInput)
|
||||
@Type(() => RefreshTokenUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => RefreshTokenUpdateInput)
|
||||
data!: RefreshTokenUpdateInput;
|
||||
|
||||
@Field(() => RefreshTokenWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyUserArgs {
|
||||
|
||||
@Field(() => [UserCreateManyInput], {nullable:false})
|
||||
@Type(() => UserCreateManyInput)
|
||||
@Type(() => UserCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => UserCreateManyInput)
|
||||
data!: Array<UserCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOneUserArgs {
|
||||
|
||||
@Field(() => UserCreateInput, {nullable:false})
|
||||
@Type(() => UserCreateInput)
|
||||
@Type(() => UserCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => UserCreateInput)
|
||||
data!: UserCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyUserArgs {
|
||||
|
||||
@Field(() => UserUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => UserUpdateManyMutationInput)
|
||||
@Type(() => UserUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => UserUpdateManyMutationInput)
|
||||
data!: UserUpdateManyMutationInput;
|
||||
|
||||
@Field(() => UserWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOneUserArgs {
|
||||
|
||||
@Field(() => UserUpdateInput, {nullable:false})
|
||||
@Type(() => UserUpdateInput)
|
||||
@Type(() => UserUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => UserUpdateInput)
|
||||
data!: UserUpdateInput;
|
||||
|
||||
@Field(() => UserWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyWorkspaceMemberArgs {
|
||||
|
||||
@Field(() => [WorkspaceMemberCreateManyInput], {nullable:false})
|
||||
@Type(() => WorkspaceMemberCreateManyInput)
|
||||
@Type(() => WorkspaceMemberCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => WorkspaceMemberCreateManyInput)
|
||||
data!: Array<WorkspaceMemberCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOneWorkspaceMemberArgs {
|
||||
|
||||
@Field(() => WorkspaceMemberCreateInput, {nullable:false})
|
||||
@Type(() => WorkspaceMemberCreateInput)
|
||||
@Type(() => WorkspaceMemberCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => WorkspaceMemberCreateInput)
|
||||
data!: WorkspaceMemberCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyWorkspaceMemberArgs {
|
||||
|
||||
@Field(() => WorkspaceMemberUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => WorkspaceMemberUpdateManyMutationInput)
|
||||
@Type(() => WorkspaceMemberUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => WorkspaceMemberUpdateManyMutationInput)
|
||||
data!: WorkspaceMemberUpdateManyMutationInput;
|
||||
|
||||
@Field(() => WorkspaceMemberWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOneWorkspaceMemberArgs {
|
||||
|
||||
@Field(() => WorkspaceMemberUpdateInput, {nullable:false})
|
||||
@Type(() => WorkspaceMemberUpdateInput)
|
||||
@Type(() => WorkspaceMemberUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => WorkspaceMemberUpdateInput)
|
||||
data!: WorkspaceMemberUpdateInput;
|
||||
|
||||
@Field(() => WorkspaceMemberWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -9,8 +9,8 @@ export class CreateManyWorkspaceArgs {
|
||||
|
||||
@Field(() => [WorkspaceCreateManyInput], {nullable:false})
|
||||
@Type(() => WorkspaceCreateManyInput)
|
||||
@Type(() => WorkspaceCreateManyInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => WorkspaceCreateManyInput)
|
||||
data!: Array<WorkspaceCreateManyInput>;
|
||||
|
||||
@Field(() => Boolean, {nullable:true})
|
||||
|
||||
@ -9,7 +9,7 @@ export class CreateOneWorkspaceArgs {
|
||||
|
||||
@Field(() => WorkspaceCreateInput, {nullable:false})
|
||||
@Type(() => WorkspaceCreateInput)
|
||||
@Type(() => WorkspaceCreateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => WorkspaceCreateInput)
|
||||
data!: WorkspaceCreateInput;
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateManyWorkspaceArgs {
|
||||
|
||||
@Field(() => WorkspaceUpdateManyMutationInput, {nullable:false})
|
||||
@Type(() => WorkspaceUpdateManyMutationInput)
|
||||
@Type(() => WorkspaceUpdateManyMutationInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => WorkspaceUpdateManyMutationInput)
|
||||
data!: WorkspaceUpdateManyMutationInput;
|
||||
|
||||
@Field(() => WorkspaceWhereInput, {nullable:true})
|
||||
|
||||
@ -10,8 +10,8 @@ export class UpdateOneWorkspaceArgs {
|
||||
|
||||
@Field(() => WorkspaceUpdateInput, {nullable:false})
|
||||
@Type(() => WorkspaceUpdateInput)
|
||||
@Type(() => WorkspaceUpdateInput)
|
||||
@ValidateNested({each: true})
|
||||
@Type(() => WorkspaceUpdateInput)
|
||||
data!: WorkspaceUpdateInput;
|
||||
|
||||
@Field(() => WorkspaceWhereUniqueInput, {nullable:false})
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
import { Controller, Get, Param, Res, UseGuards } from '@nestjs/common';
|
||||
import { Controller, Get, Param, Res } from '@nestjs/common';
|
||||
import { Response } from 'express';
|
||||
import { checkFilePath, checkFilename } from '../file.utils';
|
||||
import { FileService } from '../services/file.service';
|
||||
import { JwtAuthGuard } from 'src/guards/jwt.auth.guard';
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
// TODO: Add cookie authentication
|
||||
@Controller('files')
|
||||
export class FileController {
|
||||
constructor(private readonly fileService: FileService) {}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { FileUploadService } from './file-upload.service';
|
||||
import { S3StorageService } from 'src/integrations/s3-storage/s3-storage.service';
|
||||
import { LocalStorageService } from 'src/integrations/local-storage/local-storage.service';
|
||||
import { EnvironmentService } from 'src/integrations/environment/environment.service';
|
||||
import { FileStorageService } from 'src/integrations/file-storage/file-storage.service';
|
||||
|
||||
describe('FileUploadService', () => {
|
||||
let service: FileUploadService;
|
||||
@ -12,11 +11,7 @@ describe('FileUploadService', () => {
|
||||
providers: [
|
||||
FileUploadService,
|
||||
{
|
||||
provide: S3StorageService,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
provide: LocalStorageService,
|
||||
provide: FileStorageService,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,20 +1,13 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import sharp from 'sharp';
|
||||
import { S3StorageService } from 'src/integrations/s3-storage/s3-storage.service';
|
||||
import { kebabCase } from 'src/utils/kebab-case';
|
||||
import { EnvironmentService } from 'src/integrations/environment/environment.service';
|
||||
import { LocalStorageService } from 'src/integrations/local-storage/local-storage.service';
|
||||
import { getCropSize } from 'src/utils/image';
|
||||
import { settings } from 'src/constants/settings';
|
||||
import { FileFolder } from '../interfaces/file-folder.interface';
|
||||
import { FileStorageService } from 'src/integrations/file-storage/file-storage.service';
|
||||
|
||||
@Injectable()
|
||||
export class FileUploadService {
|
||||
constructor(
|
||||
private readonly s3Storage: S3StorageService,
|
||||
private readonly localStorage: LocalStorageService,
|
||||
private readonly environmentService: EnvironmentService,
|
||||
) {}
|
||||
constructor(private readonly fileStorage: FileStorageService) {}
|
||||
|
||||
async uploadFile({
|
||||
file,
|
||||
@ -27,23 +20,16 @@ export class FileUploadService {
|
||||
mimeType: string | undefined;
|
||||
fileFolder: FileFolder;
|
||||
}) {
|
||||
const storageType = this.environmentService.getStorageType();
|
||||
await this.fileStorage.write({
|
||||
file,
|
||||
name,
|
||||
mimeType,
|
||||
folder: fileFolder,
|
||||
});
|
||||
|
||||
switch (storageType) {
|
||||
case 's3': {
|
||||
await this.uploadFileToS3(file, name, mimeType, fileFolder);
|
||||
return {
|
||||
name: `/${name}`,
|
||||
};
|
||||
}
|
||||
case 'local':
|
||||
default: {
|
||||
await this.uploadToLocal(file, name, fileFolder);
|
||||
return {
|
||||
name: `/${name}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: `/${name}`,
|
||||
};
|
||||
}
|
||||
|
||||
async uploadImage({
|
||||
@ -88,48 +74,4 @@ export class FileUploadService {
|
||||
name: `/${name}`,
|
||||
};
|
||||
}
|
||||
|
||||
private async uploadToLocal(
|
||||
file: Buffer | Uint8Array | string,
|
||||
name: string,
|
||||
fileFolder: FileFolder,
|
||||
): Promise<void> {
|
||||
const folderName = kebabCase(fileFolder.toString());
|
||||
|
||||
try {
|
||||
const result = await this.localStorage.uploadFile({
|
||||
file,
|
||||
name,
|
||||
folder: folderName,
|
||||
});
|
||||
|
||||
return result;
|
||||
} catch (err) {
|
||||
console.log('uploadFile error: ', err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
private async uploadFileToS3(
|
||||
file: Buffer | Uint8Array | string,
|
||||
name: string,
|
||||
mimeType: string | undefined,
|
||||
fileFolder: FileFolder,
|
||||
) {
|
||||
// Aws only accept bucket with kebab-case name
|
||||
const bucketFolderName = kebabCase(fileFolder.toString());
|
||||
|
||||
try {
|
||||
const result = await this.s3Storage.uploadFile({
|
||||
Key: `${bucketFolderName}/${name}`,
|
||||
Body: file,
|
||||
ContentType: mimeType,
|
||||
});
|
||||
|
||||
return result;
|
||||
} catch (err) {
|
||||
console.log('uploadFile error: ', err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { FileService } from './file.service';
|
||||
import { S3StorageService } from 'src/integrations/s3-storage/s3-storage.service';
|
||||
import { EnvironmentService } from 'src/integrations/environment/environment.service';
|
||||
import { FileStorageService } from 'src/integrations/file-storage/file-storage.service';
|
||||
|
||||
describe('FileService', () => {
|
||||
let service: FileService;
|
||||
@ -11,7 +11,7 @@ describe('FileService', () => {
|
||||
providers: [
|
||||
FileService,
|
||||
{
|
||||
provide: S3StorageService,
|
||||
provide: FileStorageService,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,55 +1,14 @@
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { S3StorageService } from 'src/integrations/s3-storage/s3-storage.service';
|
||||
import { EnvironmentService } from 'src/integrations/environment/environment.service';
|
||||
import { createReadStream } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { Readable } from 'stream';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { FileStorageService } from 'src/integrations/file-storage/file-storage.service';
|
||||
|
||||
@Injectable()
|
||||
export class FileService {
|
||||
constructor(
|
||||
private readonly s3Storage: S3StorageService,
|
||||
private readonly environmentService: EnvironmentService,
|
||||
) {}
|
||||
constructor(private readonly fileStorageService: FileStorageService) {}
|
||||
|
||||
async getFileStream(folderPath: string, filename: string) {
|
||||
const storageType = this.environmentService.getStorageType();
|
||||
|
||||
switch (storageType) {
|
||||
case 's3':
|
||||
return this.getS3FileStream(folderPath, filename);
|
||||
case 'local':
|
||||
default:
|
||||
return this.getLocalFileStream(folderPath, filename);
|
||||
}
|
||||
}
|
||||
|
||||
private async getLocalFileStream(folderPath: string, filename: string) {
|
||||
const storageLocation = this.environmentService.getStorageLocalPath();
|
||||
|
||||
const filePath = join(
|
||||
process.cwd(),
|
||||
`${storageLocation}/`,
|
||||
return this.fileStorageService.read({
|
||||
folderPath,
|
||||
filename,
|
||||
);
|
||||
|
||||
return createReadStream(filePath);
|
||||
}
|
||||
|
||||
private async getS3FileStream(folderPath: string, filename: string) {
|
||||
try {
|
||||
const file = await this.s3Storage.getFile({
|
||||
Key: `${folderPath}/${filename}`,
|
||||
});
|
||||
|
||||
if (!file || !file.Body || !(file.Body instanceof Readable)) {
|
||||
throw new Error('Unable to get file stream');
|
||||
}
|
||||
|
||||
return Readable.from(file.Body);
|
||||
} catch (error) {
|
||||
throw new NotFoundException('File not found');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user