Initial Montech monorepo: Nuxt landing, Vue admin, Nest API.
Scaffold SSR site with CMS/blog/gallery/SEO admin and deploy configs for montech.ir. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { PrismaService } from "../prisma/prisma.service";
|
||||
|
||||
@Injectable()
|
||||
export class GalleryService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
listPublic() {
|
||||
return this.prisma.galleryItem.findMany({
|
||||
where: { published: true },
|
||||
orderBy: [{ sortOrder: "asc" }, { createdAt: "desc" }],
|
||||
});
|
||||
}
|
||||
|
||||
listAdmin() {
|
||||
return this.prisma.galleryItem.findMany({
|
||||
orderBy: [{ sortOrder: "asc" }, { createdAt: "desc" }],
|
||||
});
|
||||
}
|
||||
|
||||
create(data: {
|
||||
title: string;
|
||||
imageUrl: string;
|
||||
category?: string;
|
||||
sortOrder?: number;
|
||||
published?: boolean;
|
||||
}) {
|
||||
return this.prisma.galleryItem.create({ data });
|
||||
}
|
||||
|
||||
update(
|
||||
id: string,
|
||||
data: {
|
||||
title?: string;
|
||||
imageUrl?: string;
|
||||
category?: string | null;
|
||||
sortOrder?: number;
|
||||
published?: boolean;
|
||||
},
|
||||
) {
|
||||
return this.prisma.galleryItem.update({ where: { id }, data });
|
||||
}
|
||||
|
||||
remove(id: string) {
|
||||
return this.prisma.galleryItem.delete({ where: { id } });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user