fix empty object

This commit is contained in:
vigdorov
2020-07-12 14:53:56 +03:00
parent da55228f70
commit 31a58d0dc1
3 changed files with 12 additions and 10 deletions

View File

@ -30,7 +30,11 @@ export class StoreService {
await validateModel(createdStore);
return createdStore.save();
const savedStore = await createdStore.save();
if (!Object.keys(savedStore.value).length) {
await savedStore.updateOne(store);
}
return savedStore;
}
async update({author, ...omitProps}: StoreRequest): Promise<Store> {