feat(portfolio): add rendition management controls
This commit is contained in:
@@ -24,6 +24,7 @@ export {
|
||||
createGallery,
|
||||
createMediaAsset,
|
||||
createTag,
|
||||
deleteArtworkRendition,
|
||||
deleteGrouping,
|
||||
deleteMediaAsset,
|
||||
getMediaAssetById,
|
||||
|
||||
@@ -33,10 +33,14 @@ export async function listArtworks(limit = 24) {
|
||||
take: limit,
|
||||
include: {
|
||||
renditions: {
|
||||
orderBy: [{ isPrimary: "desc" }, { updatedAt: "desc" }],
|
||||
select: {
|
||||
id: true,
|
||||
slot: true,
|
||||
mediaAssetId: true,
|
||||
width: true,
|
||||
height: true,
|
||||
isPrimary: true,
|
||||
},
|
||||
},
|
||||
galleryLinks: {
|
||||
@@ -340,6 +344,12 @@ export async function attachArtworkRendition(input: unknown) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function deleteArtworkRendition(id: string) {
|
||||
return db.artworkRendition.delete({
|
||||
where: { id },
|
||||
})
|
||||
}
|
||||
|
||||
export async function getMediaFoundationSummary() {
|
||||
const [mediaAssets, artworks, galleries, albums, categories, tags] = await Promise.all([
|
||||
db.mediaAsset.count(),
|
||||
@@ -473,6 +483,7 @@ export async function listPublishedArtworks(input: ListPublishedArtworksInput =
|
||||
isPublished: true,
|
||||
},
|
||||
},
|
||||
orderBy: [{ isPrimary: "desc" }, { updatedAt: "desc" }],
|
||||
include: {
|
||||
mediaAsset: {
|
||||
select: {
|
||||
@@ -547,6 +558,7 @@ export async function getPublishedArtworkBySlug(slug: string) {
|
||||
isPublished: true,
|
||||
},
|
||||
},
|
||||
orderBy: [{ isPrimary: "desc" }, { updatedAt: "desc" }],
|
||||
include: {
|
||||
mediaAsset: {
|
||||
select: {
|
||||
|
||||
Reference in New Issue
Block a user