-
+
{policies.fanart === "yes"
? "check"
: policies.fanart === "ask"
@@ -83,7 +86,10 @@ export default function Index({
Fanart
-
+
{policies.fanartOthers === "yes"
? "check"
: policies.fanartOthers === "ask"
@@ -95,7 +101,10 @@ export default function Index({
-
+
{policies.fanfiction === "yes"
? "check"
: policies.fanfiction === "ask"
@@ -107,7 +116,10 @@ export default function Index({
-
+
{policies.kinning === "yes"
? "check"
: policies.kinning === "ask"
@@ -119,7 +131,10 @@ export default function Index({
-
+
{policies.shipping === "yes"
? "check"
: policies.shipping === "ask"
diff --git a/src/types/client/message.ts b/src/types/client/message.ts
new file mode 100644
index 0000000..2909727
--- /dev/null
+++ b/src/types/client/message.ts
@@ -0,0 +1,8 @@
+import * as yup from "yup";
+export const SubmitMessageSchema = yup.object({
+ subject: yup.string().min(0).max(500).ensure(),
+ body: yup.string().min(0).max(10000).ensure(),
+ to: yup.string().min(3).required()
+});
+
+export type SubmitMessage = yup.InferType;
diff --git a/src/types/message.ts b/src/types/message.ts
new file mode 100644
index 0000000..86495d5
--- /dev/null
+++ b/src/types/message.ts
@@ -0,0 +1,23 @@
+import * as yup from "yup";
+import { ObjectIdSchema } from "./assist/mongo";
+import { ClientClanSchema } from "./clan";
+import { SubmitMessageSchema } from "./client/message";
+
+export const ServerMessageSchema = SubmitMessageSchema.shape({
+ _id: ObjectIdSchema.required(),
+ date: yup.date(),
+ from: ObjectIdSchema.required(),
+ to: ObjectIdSchema.required()
+});
+
+export type ServerMessage = yup.InferType;
+
+export const ClientMessageSchema = yup.object({
+ _id: yup.string().required(),
+ date: yup.date(),
+ from: ClientClanSchema.required(),
+ subject: yup.string().min(0).max(500).ensure(),
+ body: yup.string().min(0).max(10000).ensure()
+});
+
+export type ClientMessage = yup.InferType;
diff --git a/tsconfig.json b/tsconfig.json
index 6c21b25..d1b0b32 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -19,6 +19,11 @@
"@/*": ["./src/*"]
}
},
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
+ "include": [
+ "next-env.d.ts",
+ "**/*.ts",
+ "**/*.tsx",
+ "src/pages/api/message/[clan]/.../index.ts"
+ ],
"exclude": ["node_modules"]
}