minlen
This commit is contained in:
parent
7ac246157b
commit
10f678cda9
6 changed files with 12 additions and 12 deletions
|
@ -116,7 +116,7 @@ export async function PATCH(request: NextRequest, {params}: {params: {content:st
|
|||
|
||||
let newBody:Partial<JudgementTable> = {};
|
||||
|
||||
if (body.content != null && typeof body.content === 'string' && body.content.length <= 10000) newBody.content = body.content;
|
||||
if (body.content != null && typeof body.content === 'string' && body.content.length >= 10 && body.content.length <= 10000) newBody.content = body.content;
|
||||
|
||||
let res;
|
||||
try {
|
||||
|
|
|
@ -95,7 +95,7 @@ export async function POST(request: NextRequest, {params}: {params: {content: st
|
|||
if (body.id != null) te.push("id");
|
||||
if (body.author_id != null) te.push("author_id");
|
||||
if (body.content_id != null) te.push("content_id");
|
||||
if (typeof body.content !== 'string' && body.description.length <= 10000) te.push("content");
|
||||
if (typeof body.content !== 'string' && body.description.length >= 10 && body.description.length <= 10000) te.push("content");
|
||||
if (body.published != null) te.push("published");
|
||||
|
||||
|
||||
|
|
|
@ -86,9 +86,9 @@ export async function PATCH(request: NextRequest, {params}: {params: {content:st
|
|||
|
||||
let newBody:Partial<ContentTable> = {};
|
||||
|
||||
if (body.name != null && typeof body.name === 'string' && body.name.length <= 2048) newBody.name = body.name;
|
||||
if (body.description != null && typeof body.description === 'string' && body.description.length <= 10000) newBody.description = body.description;
|
||||
if (body.url != null && typeof body.url === 'string' && body.url.length <= 2048) newBody.url = body.url;
|
||||
if (body.name != null && typeof body.name === 'string' && body.name.length >= 10 && body.name.length <= 2048) newBody.name = body.name;
|
||||
if (body.description != null && typeof body.description === 'string' && body.description.length >= 10 && body.description.length <= 10000) newBody.description = body.description;
|
||||
if (body.url != null && typeof body.url === 'string' && body.url.length >= 3 && body.url.length <= 2048) newBody.url = body.url;
|
||||
|
||||
let res;
|
||||
try {
|
||||
|
|
|
@ -100,9 +100,9 @@ export async function POST(request: NextRequest, {params}: {params: {jam: string
|
|||
if (body.id != null) te.push("id");
|
||||
if (body.author_id != null) te.push("author_id");
|
||||
if (body.jam_id != null) te.push("jam_id");
|
||||
if (typeof body.name !== 'string' && body.name.length <= 2048) te.push("name");
|
||||
if (typeof body.description !== 'string' && body.description.length <= 10000) te.push("description");
|
||||
if (typeof body.url !== 'string' && body.url.length <= 2048) te.push("url");
|
||||
if (typeof body.name !== 'string' && body.name.length >= 10 && body.name.length <= 2048) te.push("name");
|
||||
if (typeof body.description !== 'string' && body.description.length >= 10 && body.description.length <= 10000) te.push("description");
|
||||
if (typeof body.url !== 'string' && body.url.length >= 3 && body.url.length <= 2048) te.push("url");
|
||||
if (body.submitted != null) te.push("submitted");
|
||||
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ export async function PATCH(request: NextRequest, {params}: {params: {jam:string
|
|||
|
||||
let newBody:Partial<JamTable> = {};
|
||||
|
||||
if (body.name != null && typeof body.name === 'string' && body.name.length <= 2048) newBody.name = body.name;
|
||||
if (body.description != null && typeof body.description === 'string' && body.description.length <= 10000) newBody.description = body.description;
|
||||
if (body.name != null && typeof body.name === 'string' && body.name.length >= 10 && body.name.length <= 2048) newBody.name = body.name;
|
||||
if (body.description != null && typeof body.description === 'string' && body.description.length >= 10 && body.description.length <= 10000) newBody.description = body.description;
|
||||
if (body.date_start != null && typeof body.date_start === 'number') newBody.date_start = body.date_start;
|
||||
if (body.date_end != null && typeof body.date_end === 'number') newBody.date_end = body.date_end;
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ export async function POST(request: NextRequest) {
|
|||
const te = [];
|
||||
if (body.id != null) te.push("id");
|
||||
if (body.author_id != null) te.push("author_id");
|
||||
if (typeof body.name !== 'string' && body.name.length <= 2048) te.push("name");
|
||||
if (typeof body.description !== 'string' && body.description.length <= 10000) te.push("description");
|
||||
if (typeof body.name !== 'string' && body.name.length >= 10 && body.name.length <= 2048) te.push("name");
|
||||
if (typeof body.description !== 'string' && body.description.length >= 10 && body.description.length <= 10000) te.push("description");
|
||||
if (typeof body.date_start !== 'number') te.push("date_start");
|
||||
if (typeof body.date_end !== 'number') te.push("date_end");
|
||||
if (body.created != null) te.push("created");
|
||||
|
|
Loading…
Reference in a new issue