x
This commit is contained in:
1 parent
c42dd4272f
commit
730fdb49e6
8 files changed
+1611
-72
No files matched your search
@@ -345,7 +345,7 @@ export const pagesRoute = new Elysia({ prefix: "/pages" })
|
||||
orderBy: { updatedAt: "desc" },
|
||||
});
|
||||
})
|
||||
.get("/:slug", async ({ params: { slug }, query, set }) => {
|
||||
.get("/:id", async ({ params: { id: slug }, query, set }) => {
|
||||
const includeInactive =
|
||||
String((query as any)?.includeInactive || "").toLowerCase() === "true";
|
||||
const lang = (query as any)?.lang || "th";
|
||||
@@ -391,7 +391,7 @@ export const pagesRoute = new Elysia({ prefix: "/pages" })
|
||||
translations: page.translations,
|
||||
};
|
||||
})
|
||||
.get("/:slug/sections", async ({ params: { slug }, set }) => {
|
||||
.get("/:id/sections", async ({ params: { id: slug }, set }) => {
|
||||
try {
|
||||
return await prisma.pageSection.findMany({
|
||||
where: { pageId: Number(slug) },
|
||||
@@ -1031,7 +1031,7 @@ export const pagesRoute = new Elysia({ prefix: "/pages" })
|
||||
}),
|
||||
},
|
||||
)
|
||||
.delete("/:slug", async ({ params: { slug }, set }) => {
|
||||
.delete("/:id", async ({ params: { id: slug }, set }) => {
|
||||
try {
|
||||
await prisma.page.delete({
|
||||
where: { id: Number(slug) },
|
||||
@@ -1075,8 +1075,8 @@ export const pagesRoute = new Elysia({ prefix: "/pages" })
|
||||
return { success: true, translations: results, page: updated };
|
||||
}, { body: t.Any() })
|
||||
.post(
|
||||
"/:slug/sections",
|
||||
async ({ params: { slug }, body, set }) => {
|
||||
"/:id/sections",
|
||||
async ({ params: { id: slug }, body, set }) => {
|
||||
try {
|
||||
const pageId = Number(slug);
|
||||
const { type, order, payload, isActive } = body as any;
|
||||
@@ -1240,8 +1240,8 @@ export const pagesRoute = new Elysia({ prefix: "/pages" })
|
||||
},
|
||||
)
|
||||
.put(
|
||||
"/:slug/sections/reorder",
|
||||
async ({ params: { slug }, body, set }) => {
|
||||
"/:id/sections/reorder",
|
||||
async ({ params: { id: slug }, body, set }) => {
|
||||
try {
|
||||
const pageId = Number(slug);
|
||||
const { sectionOrders } = body as {
|
||||
|
||||
Reference in new issue
Block a user