Skip to content

Commit

Permalink
feat: alias
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosantangelo committed Mar 8, 2022
1 parent 0b19add commit d3a66ee
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Curation/ItemCuration/ItemCuration.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ export class ItemCuration extends Model<ItemCurationAttributes> {
curationStatus: CurationStatus
): Promise<ItemCurationAttributes | undefined> {
const itemCurations = await this.query<ItemCurationAttributes>(SQL`
SELECT *
FROM ${raw(this.tableName)} c
JOIN ${raw(Item.tableName)} i ON i.id = c.item_id
WHERE i.collection_id = ${collectionId}
AND i.status = ${curationStatus}
ORDER BY created_at DESC
SELECT item_curations.*
FROM ${raw(this.tableName)} item_curations
JOIN ${raw(Item.tableName)} items ON items.id = item_curations.item_id
WHERE items.collection_id = ${collectionId}
AND items.status = ${curationStatus}
ORDER BY item_curations.created_at DESC
LIMIT 1`)

return itemCurations[0]
Expand Down

0 comments on commit d3a66ee

Please sign in to comment.