/
dimamir
/
undb
Обзор
Документация
Войти
/
dimamir
/
undb
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/table/src/services/methods/duplicate-table-form.method.ts
18 строк
665 B
nichenqin
feat: duplicate form
19 сен 2024, 08:18
19 сен 2024, 08:18
8680a5d
Код
Авторство
О чём код?
import type { FormVO } from "../../modules" import type { IDuplicateTableFormDTO } from "../../modules/forms/dto/duplicate-form.dto" import { TableIdVo } from "../../table-id.vo" import type { TableDo } from "../../table.do" import type { TableService } from "../table.service" export async function duplicateTableFormMethod( this: TableService, dto: IDuplicateTableFormDTO, ): Promise<{ table: TableDo; form: FormVO }> { const table = (await this.repository.findOneById(new TableIdVo(dto.tableId))).expect("Not found table") const { spec, form } = table.$duplicateForm(dto) await this.repository.updateOneById(table, spec) return { table, form } }