mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-18 10:41:04 +10:00
use uuid7
This commit is contained in:
@ -7,7 +7,7 @@ import {
|
||||
prepareFile,
|
||||
validateFileType,
|
||||
} from '../attachment.utils';
|
||||
import { v4 as uuid4 } from 'uuid';
|
||||
import { v4 as uuid4, v7 as uuid7 } from 'uuid';
|
||||
import { AttachmentRepo } from '@docmost/db/repos/attachment/attachment.repo';
|
||||
import { AttachmentType, validImageExtensions } from '../attachment.constants';
|
||||
import { KyselyDB, KyselyTransaction } from '@docmost/db/types/kysely.types';
|
||||
@ -40,7 +40,7 @@ export class AttachmentService {
|
||||
const { filePromise, pageId, spaceId, userId, workspaceId } = opts;
|
||||
const preparedFile: PreparedFile = await prepareFile(filePromise);
|
||||
|
||||
const attachmentId = uuid4();
|
||||
const attachmentId = uuid7();
|
||||
const filePath = `${getAttachmentFolderPath(AttachmentType.File, workspaceId)}/${attachmentId}/${preparedFile.fileName}`;
|
||||
|
||||
await this.uploadToDrive(filePath, preparedFile.buffer);
|
||||
|
||||
@ -7,6 +7,6 @@ export class AddGroupUserDto extends GroupIdDto {
|
||||
message: 'you cannot add more than 50 users at a time',
|
||||
})
|
||||
@ArrayMinSize(1)
|
||||
@IsUUID(4, { each: true })
|
||||
@IsUUID('all', { each: true })
|
||||
userIds: string[];
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ export class CreateGroupDto {
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ArrayMaxSize(50)
|
||||
@IsUUID(4, { each: true })
|
||||
@IsUUID('all', { each: true })
|
||||
userIds?: string[];
|
||||
}
|
||||
|
||||
|
||||
@ -14,13 +14,13 @@ export class AddSpaceMembersDto extends SpaceIdDto {
|
||||
@ArrayMaxSize(25, {
|
||||
message: 'userIds must an array with no more than 25 elements',
|
||||
})
|
||||
@IsUUID(4, { each: true })
|
||||
@IsUUID('all', { each: true })
|
||||
userIds: string[];
|
||||
|
||||
@IsArray()
|
||||
@ArrayMaxSize(25, {
|
||||
message: 'userIds must an array with no more than 25 elements',
|
||||
})
|
||||
@IsUUID(4, { each: true })
|
||||
@IsUUID('all', { each: true })
|
||||
groupIds: string[];
|
||||
}
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
import { IsOptional, IsString, MaxLength, MinLength } from 'class-validator';
|
||||
import {
|
||||
IsAlphanumeric,
|
||||
IsOptional,
|
||||
IsString,
|
||||
MaxLength,
|
||||
MinLength,
|
||||
} from 'class-validator';
|
||||
|
||||
export class CreateSpaceDto {
|
||||
@MinLength(2)
|
||||
@ -12,6 +18,6 @@ export class CreateSpaceDto {
|
||||
|
||||
@MinLength(2)
|
||||
@MaxLength(50)
|
||||
@IsString()
|
||||
@IsAlphanumeric()
|
||||
slug: string;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ export class InviteUserDto {
|
||||
message: 'you cannot add invited users to more than 25 groups at a time',
|
||||
})
|
||||
@ArrayMinSize(0)
|
||||
@IsUUID(4, { each: true })
|
||||
@IsUUID('all', { each: true })
|
||||
groupIds: string[];
|
||||
|
||||
@IsEnum(UserRole)
|
||||
|
||||
Reference in New Issue
Block a user