fixed created/changedby save in tenants
MODIFY
src/assets/schemas/common/common.json
src/assets/schemas/common/common.json
"type": "string",
"format": "email",
"sanitize": "mongo",
- "transform": ["toLowerCase"]
+ "transform": [
+ "toLowerCase"
+ ]
+ },
+ "createdBy": {
+ "type": "object",
+ "nullable": true,
+ "properties": {
+ "id": {
+ "$ref": "#/definitions/id"
+ }
+ }
+ },
+ "createdOn": {
+ "type": "object",
+ "nullable": true,
+ "sanitize": "mongo"
+ },
+ "lastChangedBy": {
+ "type": "object",
+ "nullable": true,
+ "properties": {
+ "id": {
+ "$ref": "#/definitions/id"
+ }
+ }
+ },
+ "lastChangedOn": {
+ "type": "object",
+ "nullable": true,
+ "sanitize": "mongo"
}
}
}

MODIFY
src/assets/schemas/tenant/tenant.json
src/assets/schemas/tenant/tenant.json
},
"logo": {
"$ref": "common#/definitions/logo"
+ },
+ "createdBy": {
+ "$ref": "common#/definitions/createdBy"
+ },
+ "createdOn": {
+ "$ref": "common#/definitions/createdOn"
+ },
+ "lastChangedBy": {
+ "$ref": "common#/definitions/lastChangedBy"
+ },
+ "lastChangedOn": {
+ "$ref": "common#/definitions/lastChangedOn"
}
},
"required": [

MODIFY
src/storage/mongodb/TenantStorage.ts
src/storage/mongodb/TenantStorage.ts
@@ -51,7 +51,7 @@ export default class TenantStorage {
// Remove ID
delete tenantMDB.id;
// Add Last Changed/Created props
- DatabaseUtils.addLastChangedCreatedProps(tenantMDB, tenantToSave);
+ DatabaseUtils.addLastChangedCreatedProps(tenantMDB, Utils.cloneObject(tenantToSave));
// Modify
await global.database.getCollection<Tenant>(Constants.DEFAULT_TENANT, 'tenants').findOneAndUpdate(
tenantFilter,

fixed created/changedby save in tenants