feat: add note to alert type

This commit is contained in:
Simon Larsen 2024-10-08 22:04:51 +01:00
parent 09196f397e
commit 8590cfa4c0
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
2 changed files with 18 additions and 21 deletions

View File

@ -114,7 +114,7 @@ export class Service extends DatabaseService<AlertStateTimeline> {
const internalNote: string | undefined = (
createBy.miscDataProps as JSONObject | undefined
)?.["publicNote"] as string | undefined;
)?.["internalNote"] as string | undefined;
if (internalNote) {
const alertNote: AlertInternalNote = new AlertInternalNote();

View File

@ -671,28 +671,25 @@ class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
);
}
let tenantId: ObjectID | undefined = createBy.props.tenantId;
if (!tenantId && this.getModel().getTenantColumn()) {
tenantId = createBy.data.getValue<ObjectID>(
this.getModel().getTenantColumn()!,
);
}
// hit workflow.;
if (this.getModel().enableWorkflowOn?.create) {
let tenantId: ObjectID | undefined = createBy.props.tenantId;
if (this.getModel().enableWorkflowOn?.create && tenantId) {
await this.onTriggerWorkflow(createBy.data.id!, tenantId, "on-create");
}
if (!tenantId && this.getModel().getTenantColumn()) {
tenantId = createBy.data.getValue<ObjectID>(
this.getModel().getTenantColumn()!,
);
}
if (tenantId) {
await this.onTriggerWorkflow(
createBy.data.id!,
tenantId,
"on-create",
);
await this.onTriggerRealtime(
createBy.data.id!,
tenantId,
ModelEventType.Create,
);
}
if (tenantId) {
await this.onTriggerRealtime(
createBy.data.id!,
tenantId,
ModelEventType.Create,
);
}
return createBy.data;