feat: account
This commit is contained in:
@@ -3,7 +3,8 @@ import { Block, PageMeta, PageStatus, PageType } from "./types";
|
||||
import { prisma } from "../prisma";
|
||||
|
||||
export async function getPages(type: PageType, status: PageStatus, limit?: number) {
|
||||
return await prisma.page.findMany({ where: { type, status }, take: limit, orderBy: { publishedAt: "desc" }, });
|
||||
// return await prisma.page.findMany({ where: { type, status }, take: limit, orderBy: { publishedAt: "desc" }, });
|
||||
return []
|
||||
}
|
||||
|
||||
export async function getPageById(id: string) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { getSessionUserId } from "@/lib/auth/session";
|
||||
import { findUserById } from "@/lib/user/repository";
|
||||
import { fetchKotosoftUser } from "./kotosoft/client";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export async function getCurrentUser() {
|
||||
const userId = await getSessionUserId();
|
||||
|
||||
@@ -31,4 +31,20 @@ export async function updateUser(id: string, data: Partial<Omit<UserData, "kotos
|
||||
...(data.birthDate ? { birthDate: new Date(data.birthDate) } : {}),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteUser(id: string) {
|
||||
await prisma.page.updateMany({
|
||||
where: { createdBy: id },
|
||||
data: { createdBy: null }
|
||||
});
|
||||
|
||||
await prisma.page.updateMany({
|
||||
where: { updatedBy: id },
|
||||
data: { updatedBy: null }
|
||||
});
|
||||
|
||||
await prisma.user.delete({
|
||||
where: { id }
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user