docs, saveWithCtx

This commit is contained in:
Tom Moor committed 2024-11-10 11:34:43 -05:00
1 parent 18d25b0e0e
commit a8391dfec0
2 files changed
+12 -1

No files matched your search

+1
View File
@@ -55,6 +55,7 @@ class Event extends IdModel<
/**
* Metadata associated with the event, previously used for storing some changed attributes.
* Note that the `data` column will be visible to the client and API requests.
*/
@Column(DataType.JSONB)
data: Record<string, any> | null;
+11 -1
View File
@@ -12,6 +12,7 @@ import {
InstanceUpdateOptions,
ModelStatic,
NonAttribute,
InstanceSaveOptions,
} from "sequelize";
import {
AfterCreate,
@@ -29,10 +30,19 @@ class Model<
TCreationAttributes extends {} = TModelAttributes
> extends SequelizeModel<TModelAttributes, TCreationAttributes> {
/**
* The namespace to use for events, if none is provided an event will not be created.
* The namespace to use for events, if none is provided an event will not be created
* during the migration period. In the future this may default to the table name.
*/
static eventNamespace: string | undefined;
/**
* Validates this instance, and if the validation passes, persists it to the database.
*/
public saveWithCtx(ctx: APIContext) {
this.cacheChangeset();
return this.save(ctx.context as InstanceSaveOptions);
}
/**
* This is the same as calling `set` and then calling `save`.
*/