/
dimamir
/
undb
Обзор
Документация
Войти
/
dimamir
/
undb
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/commands/src/create-table.command.ts
28 строк
968 B
nichenqin
feat: create from template
21 сен 2024, 15:46
21 сен 2024, 15:46
b106abf
Код
Авторство
О чём код?
import { baseIdSchema, baseNameSchema } from "@undb/base" import { Command, type CommandProps } from "@undb/domain" import type { ICreateSchemaDTO } from "@undb/table" import { createTableDTO } from "@undb/table" import { z } from "@undb/zod" export const createTableCommand = createTableDTO .omit({ spaceId: true }) .merge(z.object({ baseId: baseIdSchema.optional(), baseName: baseNameSchema.optional() })) export type ICreateTableCommand = z.infer<typeof createTableCommand> export class CreateTableCommand extends Command implements ICreateTableCommand { public readonly id?: string public readonly name: string public readonly baseId?: string public readonly baseName?: string public readonly schema: ICreateSchemaDTO constructor(props: CommandProps<ICreateTableCommand>) { super(props) this.id = props.id this.name = props.name this.baseId = props.baseId this.baseName = props.baseName this.schema = props.schema } }