Bumping created_at & updated_at fields to the end of schemas
This commit is contained in:
@@ -94,12 +94,34 @@ export class JsonschemasService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.changePropertiesOrder(resource);
|
||||
observer.next(resource);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
changePropertiesOrder(resource: any) {
|
||||
let created_at;
|
||||
let updated_at;
|
||||
let new_properties: any = {};
|
||||
for (let prop_name in resource.properties) {
|
||||
if (prop_name == 'created_at') {
|
||||
created_at = resource.properties[prop_name];
|
||||
} else if (prop_name == 'updated_at') {
|
||||
updated_at = resource.properties[prop_name];
|
||||
} else {
|
||||
new_properties[prop_name] = resource.properties[prop_name];
|
||||
}
|
||||
}
|
||||
if (created_at) {
|
||||
new_properties['created_at'] = created_at;
|
||||
}
|
||||
if (updated_at) {
|
||||
new_properties['updated_at'] = updated_at;
|
||||
}
|
||||
resource.properties = new_properties
|
||||
}
|
||||
|
||||
private is_object(prop: any) {
|
||||
return prop.hasOwnProperty('properties')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user