/
dimamir
/
undb
Обзор
Документация
Войти
/
dimamir
/
undb
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/table/src/methods/set-view-fields.method.ts
27 строк
829 B
nichenqin
fix: fix event spaceis
18 окт 2024, 11:51
18 окт 2024, 11:51
4b42997
Код
Авторство
О чём код?
import type { Option } from "@undb/domain" import type { ISetViewFieldsDTO } from "../dto" import { SetViewFieldsEvent } from "../events" import type { TableComositeSpecification } from "../specifications" import type { TableDo } from "../table.do" export function setViewFields(this: TableDo, dto: ISetViewFieldsDTO): Option<TableComositeSpecification> { const view = this.views.getViewById(dto.viewId) const spec = view.$setFieldsSpec(dto.fields) if (spec.isSome()) { spec.unwrap().mutate(this) const event = new SetViewFieldsEvent( { tableId: this.id.value, viewId: view.id.value, previous: spec.unwrap().previous.into(null) ?? null, fields: view.fields.into(null)?.toJSON() ?? null, }, this.spaceId, ) this.addDomainEvent(event) } return spec }