Add moveToTop on portfolio update so items pin to absolute list top.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
af0573c089
commit
37bce1e9fa
@@ -280,6 +280,10 @@ export class PortfoliosService {
|
||||
}
|
||||
}
|
||||
|
||||
const pinnedSortOrder = dto.moveToTop
|
||||
? await this.nextSortOrder(businessId)
|
||||
: undefined;
|
||||
|
||||
const updated = await this.prisma.$transaction(async (tx) => {
|
||||
const data: Prisma.portfoliosUncheckedUpdateInput = {
|
||||
slug,
|
||||
@@ -302,7 +306,9 @@ export class PortfoliosService {
|
||||
if (featuredMediaId !== undefined) {
|
||||
data.featured_media_id = featuredMediaId;
|
||||
}
|
||||
if (dto.sortOrder !== undefined) {
|
||||
if (pinnedSortOrder !== undefined) {
|
||||
data.sort_order = pinnedSortOrder;
|
||||
} else if (dto.sortOrder !== undefined) {
|
||||
data.sort_order = dto.sortOrder;
|
||||
}
|
||||
if (publishedAt !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user