style: format code with prettier agian
This commit is contained in:
1 parent
e6d7f2280b
commit
8efd032cc6
71 files changed
+6796
-3751
No files matched your search
@@ -14,17 +14,25 @@ import { logServerError } from "@/lib/server-log";
|
||||
// created_at/updated_at are managed here.
|
||||
|
||||
function parseMinRank(formData: FormData): number {
|
||||
const n = Number(String(formData.get("minRank") ?? "").normalize("NFC").trim());
|
||||
const n = Number(
|
||||
String(formData.get("minRank") ?? "")
|
||||
.normalize("NFC")
|
||||
.trim(),
|
||||
);
|
||||
return Number.isInteger(n) && n >= 0 ? n : 1;
|
||||
}
|
||||
|
||||
export async function createPermission(formData: FormData): Promise<void> {
|
||||
const staff = await requireStaff();
|
||||
const permission = String(formData.get("permission") ?? "").normalize("NFC")
|
||||
const permission = String(formData.get("permission") ?? "")
|
||||
.normalize("NFC")
|
||||
.trim()
|
||||
.slice(0, 255);
|
||||
const minRank = parseMinRank(formData);
|
||||
const description = String(formData.get("description") ?? "").normalize("NFC").trim() || null;
|
||||
const description =
|
||||
String(formData.get("description") ?? "")
|
||||
.normalize("NFC")
|
||||
.trim() || null;
|
||||
if (!permission) return;
|
||||
|
||||
const now = new Date();
|
||||
@@ -54,11 +62,15 @@ export async function updatePermission(formData: FormData): Promise<void> {
|
||||
const raw = String(formData.get("id") ?? "").normalize("NFC");
|
||||
if (!raw) return;
|
||||
const id = BigInt(raw);
|
||||
const permission = String(formData.get("permission") ?? "").normalize("NFC")
|
||||
const permission = String(formData.get("permission") ?? "")
|
||||
.normalize("NFC")
|
||||
.trim()
|
||||
.slice(0, 255);
|
||||
const minRank = parseMinRank(formData);
|
||||
const description = String(formData.get("description") ?? "").normalize("NFC").trim() || null;
|
||||
const description =
|
||||
String(formData.get("description") ?? "")
|
||||
.normalize("NFC")
|
||||
.trim() || null;
|
||||
if (!permission) return;
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user