마에스트로 상세화면에 암호 초기화 버튼 추가 (암호 초기화: 123456)

This commit is contained in:
2026-07-05 13:48:17 +09:00
parent a15543859e
commit ff67e5cf5a
3 changed files with 107 additions and 2 deletions
+25
View File
@@ -255,6 +255,31 @@ export async function updateMaestro(
return { changed: true };
}
export async function resetMaestroPassword(
maestroID: number
): Promise<boolean> {
const maestro = await db.maestro.findUnique({
where: { MaestroID: maestroID },
select: { MaestroID: true },
});
if (!maestro) return false;
await db.$transaction(async (tx) => {
await tx.$executeRaw`UPDATE maestro SET Password = PASSWORD('123456') WHERE MaestroID = ${maestroID}`;
await tx.maestro_log.create({
data: {
Type: "reset_maestro_password",
MaestroID: maestroID,
LogDateTime: new Date(),
Remark: "admin reset to 123456",
},
});
});
return true;
}
const logPageSizeOptions = [10, 20, 50] as const;
type LogPageSize = (typeof logPageSizeOptions)[number];