Return created item on create

Closes #42
This commit is contained in:
rijkvanzanten
2020-06-29 17:14:27 -04:00
parent 9e500c7e78
commit 1f48fef8c0

View File

@@ -6,7 +6,8 @@ export const createItem = async (
data: Record<string, any>,
query: Query = {}
) => {
await database(collection).insert(data);
const result = await database(collection).insert(data).returning('id');
return readItem(collection, result[0], query);
};
export const readItems = async (collection: string, query: Query = {}) => {