tachybase_todo/packages/core/database/src/view-collection.ts
ChengLei Shao 3510531182
feat(database): view collection support for add new, update and delete actions (#2119)
* feat: writeableView options in view collection

* refactor: view collection support edit

* refactor: view collection support edit

* refactor: view collection support edit

* refactor: view collection support edit

* test: insert into view with join table

* chore: typo

* chore: package.json

* chore: sql parser

* chore: query interface

* chore: test

* feat: update view collection

* chore: test

* chore: test

* chore: github action pg version

* fix: params in update and delete

* refactor: locale improve

---------

Co-authored-by: katherinehhh <katherine_15995@163.com>
2023-07-14 14:49:12 +08:00

21 lines
539 B
TypeScript

import { Collection, CollectionContext, CollectionOptions } from './collection';
export class ViewCollection extends Collection {
constructor(options: CollectionOptions, context: CollectionContext) {
options.autoGenId = false;
options.timestamps = false;
super(options, context);
}
isView() {
return true;
}
protected sequelizeModelOptions(): any {
const modelOptions = super.sequelizeModelOptions();
modelOptions.tableName = this.options.viewName || this.options.name;
return modelOptions;
}
}