/
dimamir
/
undb
Обзор
Документация
Войти
/
dimamir
/
undb
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/table/src/methods/update-field.method.ts
27 строк
988 B
nichenqin
feat: support to filter formula
30 окт 2024, 08:24
30 окт 2024, 08:24
6688155
Код
Авторство
О чём код?
import { Option, Some, applyRules } from "@undb/domain" import { FieldUpdatedEvent } from "../events" import { type IUpdateFieldDTO } from "../modules" import { FieldIdShouldBeUnique } from "../modules/schema/rules/field-id-should-be-unique.rule" import { FieldNameShouldBeUnique } from "../modules/schema/rules/field-name-should-be-unique.rule" import type { TableComositeSpecification } from "../specifications" import type { TableDo } from "../table.do" export function updateFieldMethod(this: TableDo, dto: IUpdateFieldDTO): Option<TableComositeSpecification> { const spec = this.schema.$updateField(this, dto) // TODO: update form spec.mutate(this) applyRules(new FieldNameShouldBeUnique(this.schema), new FieldIdShouldBeUnique(this.schema)) const event = new FieldUpdatedEvent( { tableId: this.id.value, field: spec.field.toJSON(), previous: spec.previous.toJSON(), }, this.spaceId, ) this.addDomainEvent(event) return Some(spec) }