Add ToS
This commit is contained in:
10
src/actions/tos/getTos.ts
Normal file
10
src/actions/tos/getTos.ts
Normal file
@ -0,0 +1,10 @@
|
||||
'use server';
|
||||
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
export async function getLatestTos(): Promise<string | null> {
|
||||
const tos = await prisma.termsOfService.findFirst({
|
||||
orderBy: { createdAt: 'desc' },
|
||||
});
|
||||
return tos?.markdown ?? null;
|
||||
}
|
||||
11
src/actions/tos/saveTos.ts
Normal file
11
src/actions/tos/saveTos.ts
Normal file
@ -0,0 +1,11 @@
|
||||
'use server';
|
||||
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
export async function saveTosAction(markdown: string) {
|
||||
await prisma.termsOfService.create({
|
||||
data: {
|
||||
markdown,
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user