Minor refinements & tuning to system structure

This commit is contained in:
2025-12-23 15:57:05 +08:00
parent 6c63f2d803
commit d06a58cf93
8 changed files with 394 additions and 87 deletions

View File

@@ -75,13 +75,6 @@ describe('DollsService', () => {
const createDto = { name: 'New Doll' };
const userId = 'user-1';
// Mock the transaction callback to return the doll
jest
.spyOn(prismaService, '$transaction')
.mockImplementation(async (callback) => {
return callback(prismaService);
});
await service.create(userId, createDto);
expect(prismaService.doll.create).toHaveBeenCalledWith({

View File

@@ -0,0 +1,48 @@
import {
IsString,
IsNotEmpty,
IsOptional,
ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { DollConfigurationDto } from './create-doll.dto';
export class ActiveDollDto {
@ApiProperty({
description: 'Unique identifier of the doll',
example: '550e8400-e29b-41d4-a716-446655440000',
})
@IsString()
@IsNotEmpty()
id: string;
@ApiProperty({
description: 'Display name of the doll',
example: 'My First Doll',
})
@IsString()
@IsNotEmpty()
name: string;
@ApiPropertyOptional({
description: 'Configuration for the doll',
type: DollConfigurationDto,
})
@IsOptional()
@ValidateNested()
@Type(() => DollConfigurationDto)
configuration?: DollConfigurationDto;
@ApiProperty({
description: 'Creation date of the doll',
example: '2023-01-01T00:00:00.000Z',
})
createdAt: Date;
@ApiProperty({
description: 'Last update date of the doll',
example: '2023-01-01T00:00:00.000Z',
})
updatedAt: Date;
}