add quotes and fix the. partials

This commit is contained in:
MeowcaTheoRange 2023-07-06 00:08:52 -05:00
parent 276d85dfdb
commit 588868a26b
4 changed files with 13 additions and 9 deletions

View file

@ -36,8 +36,8 @@ export function SubmitTrollToServerTroll(
quirks: submitTroll.quirks quirks: submitTroll.quirks
? Object.fromEntries(submitTroll.quirks) ? Object.fromEntries(submitTroll.quirks)
: undefined, : undefined,
owners: [], owners: undefined,
flairs: [], flairs: undefined,
updatedDate: new Date() updatedDate: new Date()
}; };
return serverTroll; return serverTroll;

View file

@ -53,6 +53,7 @@ export default async function handler(
}); });
if (thisUser == null || !compareCredentials(thisUser, cookies)) if (thisUser == null || !compareCredentials(thisUser, cookies))
return res.status(403).end(); return res.status(403).end();
console.log(getLevel(thisUser));
if (!compareLevels(getLevel(thisUser), "MODERATOR")) if (!compareLevels(getLevel(thisUser), "MODERATOR"))
return res.status(403).end(); return res.status(403).end();
} }
@ -68,6 +69,3 @@ export default async function handler(
res.json(newTroll); res.json(newTroll);
} else return res.status(405).end(); } else return res.status(405).end();
} }
// 1119731948118605995
// 1089603977131331584

View file

@ -17,3 +17,9 @@ export const SubmitQuirkHolderSchema = yup
); );
export type SubmitQuirkHolder = yup.InferType<typeof SubmitQuirkHolderSchema>; export type SubmitQuirkHolder = yup.InferType<typeof SubmitQuirkHolderSchema>;
export const PartialQuirkHolderSchema = yup
.array()
.of(yup.tuple([yup.string().lowercase(), QuirkSchema]));
export type PartialQuirkHolder = yup.InferType<typeof PartialQuirkHolderSchema>;

View file

@ -2,7 +2,7 @@ import { ColorSchema } from "@/types/assist/color";
import * as yup from "yup"; import * as yup from "yup";
import { ClassKeys, TrueSignKeys } from "../assist/extended_zodiac"; import { ClassKeys, TrueSignKeys } from "../assist/extended_zodiac";
import { PolicySchema } from "../assist/generics"; import { PolicySchema } from "../assist/generics";
import { SubmitQuirkHolderSchema } from "./quirks"; import { PartialQuirkHolderSchema, SubmitQuirkHolderSchema } from "./quirks";
export const SubmitTrollSchema = yup export const SubmitTrollSchema = yup
.object({ .object({
@ -122,7 +122,7 @@ export const SubmitTrollSchema = yup
), ),
textColor: ColorSchema.notRequired(), // default to trueSign color if undefined, textColor: ColorSchema.notRequired(), // default to trueSign color if undefined,
quirks: SubmitQuirkHolderSchema.required(), // DO NOT HANDLE RIGHT NOW. quirks: SubmitQuirkHolderSchema.required(), // DO NOT HANDLE RIGHT NOW.
// Handled! :D quotes: yup.array().of(yup.string().max(1000)).required(),
// Physical stuff // Physical stuff
species: yup species: yup
@ -238,8 +238,8 @@ export const PartialTrollSchema = yup
yup.number().min(0).max(255), yup.number().min(0).max(255),
yup.number().min(0).max(255) yup.number().min(0).max(255)
]), ]),
quirks: SubmitQuirkHolderSchema, // DO NOT HANDLE RIGHT NOW. quirks: PartialQuirkHolderSchema, // DO NOT HANDLE RIGHT NOW.
// Handled! :D quotes: yup.array().of(yup.string().max(1000)),
// Physical stuff // Physical stuff
species: yup species: yup