|
@@ -9,6 +9,7 @@ import { TemplateBasicInfoDto } from './dto/template-basic-info.dto';
|
|
|
import { UpdateTemplateBasicInfoDto } from './dto/update-template-basic-info.dto';
|
|
import { UpdateTemplateBasicInfoDto } from './dto/update-template-basic-info.dto';
|
|
|
import { TemplateAiClient } from './template-ai.client';
|
|
import { TemplateAiClient } from './template-ai.client';
|
|
|
import { TemplateTaskRunner } from './template-task-runner';
|
|
import { TemplateTaskRunner } from './template-task-runner';
|
|
|
|
|
+import { normalizeTemplateNameI18n, type TemplateNameI18n } from './template-name-i18n';
|
|
|
|
|
|
|
|
type TemplateListQuery = ListTemplatesQueryDto & {
|
|
type TemplateListQuery = ListTemplatesQueryDto & {
|
|
|
stylistId: bigint;
|
|
stylistId: bigint;
|
|
@@ -72,6 +73,7 @@ export class TemplatesService {
|
|
|
private toBasicInfoDto(template: {
|
|
private toBasicInfoDto(template: {
|
|
|
id: bigint;
|
|
id: bigint;
|
|
|
templateName: string;
|
|
templateName: string;
|
|
|
|
|
+ templateNameI18n: unknown;
|
|
|
status: 'DRAFT' | 'PUBLIC';
|
|
status: 'DRAFT' | 'PUBLIC';
|
|
|
category: 'LONG' | 'MEDIUM' | 'SHORT' | 'DYE';
|
|
category: 'LONG' | 'MEDIUM' | 'SHORT' | 'DYE';
|
|
|
tags: string;
|
|
tags: string;
|
|
@@ -82,6 +84,7 @@ export class TemplatesService {
|
|
|
return {
|
|
return {
|
|
|
id: template.id.toString(),
|
|
id: template.id.toString(),
|
|
|
templateName: template.templateName,
|
|
templateName: template.templateName,
|
|
|
|
|
+ templateNameI18n: normalizeTemplateNameI18n(template.templateNameI18n),
|
|
|
status: template.status,
|
|
status: template.status,
|
|
|
category: template.category,
|
|
category: template.category,
|
|
|
tags: template.tags
|
|
tags: template.tags
|
|
@@ -100,6 +103,7 @@ export class TemplatesService {
|
|
|
template: {
|
|
template: {
|
|
|
id: bigint;
|
|
id: bigint;
|
|
|
templateName: string;
|
|
templateName: string;
|
|
|
|
|
+ templateNameI18n: unknown;
|
|
|
category: 'LONG' | 'MEDIUM' | 'SHORT' | 'DYE';
|
|
category: 'LONG' | 'MEDIUM' | 'SHORT' | 'DYE';
|
|
|
status: 'DRAFT' | 'PUBLIC';
|
|
status: 'DRAFT' | 'PUBLIC';
|
|
|
description: string | null;
|
|
description: string | null;
|
|
@@ -114,6 +118,7 @@ export class TemplatesService {
|
|
|
return {
|
|
return {
|
|
|
id: template.id.toString(),
|
|
id: template.id.toString(),
|
|
|
name: template.templateName,
|
|
name: template.templateName,
|
|
|
|
|
+ nameI18n: normalizeTemplateNameI18n(template.templateNameI18n),
|
|
|
category: template.category,
|
|
category: template.category,
|
|
|
status: template.status,
|
|
status: template.status,
|
|
|
description: template.description ?? '',
|
|
description: template.description ?? '',
|
|
@@ -199,6 +204,7 @@ export class TemplatesService {
|
|
|
const template = await tx.hairTemplate.create({
|
|
const template = await tx.hairTemplate.create({
|
|
|
data: {
|
|
data: {
|
|
|
templateName: dto.templateName,
|
|
templateName: dto.templateName,
|
|
|
|
|
+ templateNameI18n: normalizeTemplateNameI18n(dto.templateNameI18n) ?? undefined,
|
|
|
coverUrl: '',
|
|
coverUrl: '',
|
|
|
status: dto.status,
|
|
status: dto.status,
|
|
|
category: dto.category,
|
|
category: dto.category,
|
|
@@ -288,6 +294,7 @@ export class TemplatesService {
|
|
|
where: { id: template.id },
|
|
where: { id: template.id },
|
|
|
data: {
|
|
data: {
|
|
|
templateName: dto.templateName,
|
|
templateName: dto.templateName,
|
|
|
|
|
+ templateNameI18n: normalizeTemplateNameI18n(dto.templateNameI18n) ?? undefined,
|
|
|
status: dto.status,
|
|
status: dto.status,
|
|
|
category: dto.category,
|
|
category: dto.category,
|
|
|
tags: (dto.tags ?? []).join(','),
|
|
tags: (dto.tags ?? []).join(','),
|
|
@@ -487,6 +494,7 @@ export class TemplatesService {
|
|
|
makeTaskId?: string;
|
|
makeTaskId?: string;
|
|
|
makeTaskStatus?: string;
|
|
makeTaskStatus?: string;
|
|
|
usedCount: number;
|
|
usedCount: number;
|
|
|
|
|
+ nameI18n: TemplateNameI18n | null;
|
|
|
}>;
|
|
}>;
|
|
|
total: number;
|
|
total: number;
|
|
|
page: number;
|
|
page: number;
|
|
@@ -524,6 +532,7 @@ export class TemplatesService {
|
|
|
select: {
|
|
select: {
|
|
|
id: true,
|
|
id: true,
|
|
|
templateName: true,
|
|
templateName: true,
|
|
|
|
|
+ templateNameI18n: true,
|
|
|
category: true,
|
|
category: true,
|
|
|
status: true,
|
|
status: true,
|
|
|
description: true,
|
|
description: true,
|