2024-07-26 19:15:13 +00:00
|
|
|
"use server";
|
|
|
|
|
|
|
|
import { getAuth } from "@/auth/queries/getauth";
|
|
|
|
import { artemis, daphnis } from "@/lib/prisma";
|
|
|
|
import type * as Prisma from "@prisma/client";
|
|
|
|
|
|
|
|
// type ChuniScorePlaylog = Prisma.PrismaClient;
|
|
|
|
// type ChuniStaticMusic = Prisma.PrismaClient;
|
|
|
|
|
|
|
|
export async function getCurrentSystemVoice() {
|
|
|
|
const { user } = await getAuth();
|
|
|
|
|
|
|
|
if (!user || !user.accessCode) {
|
|
|
|
throw new Error("User is not authenticated or accessCode is missing");
|
|
|
|
}
|
|
|
|
|
2024-07-28 05:16:27 +00:00
|
|
|
const currentSystemVoice = await artemis.chuni_profile_data.findMany({
|
2024-07-26 19:15:13 +00:00
|
|
|
where: {
|
|
|
|
user: user.UserId,
|
|
|
|
},
|
|
|
|
select: {
|
|
|
|
voiceId: true,
|
|
|
|
},
|
|
|
|
});
|
2024-07-28 05:16:27 +00:00
|
|
|
return currentSystemVoice;
|
2024-07-26 19:15:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function getSystemVoices() {
|
|
|
|
const { user } = await getAuth();
|
|
|
|
|
|
|
|
if (!user || !user.accessCode) {
|
|
|
|
throw new Error("User is not authenticated or accessCode is missing");
|
|
|
|
}
|
|
|
|
|
2024-07-28 05:16:27 +00:00
|
|
|
const AllSystemVoices =
|
|
|
|
await artemis.cozynet_chuni_static_systemvoice.findMany({
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
str: true,
|
|
|
|
sortName: true,
|
|
|
|
category: true,
|
|
|
|
imagePath: true,
|
|
|
|
rareType: true,
|
|
|
|
netOpenName: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
return AllSystemVoices;
|
2024-07-26 19:15:13 +00:00
|
|
|
}
|