mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
fix: increase max length for groups and spaces (#1840)
This commit is contained in:
@@ -9,7 +9,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { zodResolver } from 'mantine-form-zod-resolver';
|
import { zodResolver } from 'mantine-form-zod-resolver';
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
name: z.string().trim().min(2).max(50),
|
name: z.string().trim().min(2).max(100),
|
||||||
description: z.string().max(500),
|
description: z.string().max(500),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Group, Box, Button, TextInput, Stack, Textarea } from "@mantine/core";
|
import { Group, Box, Button, TextInput, Stack, Textarea } from "@mantine/core";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useForm, zodResolver } from "@mantine/form";
|
import { useForm } from "@mantine/form";
|
||||||
|
import { zodResolver } from "mantine-form-zod-resolver";
|
||||||
import * as z from "zod";
|
import * as z from "zod";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useCreateSpaceMutation } from "@/features/space/queries/space-query.ts";
|
import { useCreateSpaceMutation } from "@/features/space/queries/space-query.ts";
|
||||||
@@ -9,12 +10,12 @@ import { getSpaceUrl } from "@/lib/config.ts";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
name: z.string().trim().min(2).max(50),
|
name: z.string().trim().min(2).max(100),
|
||||||
slug: z
|
slug: z
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(2)
|
.min(2)
|
||||||
.max(50)
|
.max(100)
|
||||||
.regex(
|
.regex(
|
||||||
/^[a-zA-Z0-9]+$/,
|
/^[a-zA-Z0-9]+$/,
|
||||||
"Space slug must be alphanumeric. No special characters",
|
"Space slug must be alphanumeric. No special characters",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {Transform, TransformFnParams} from "class-transformer";
|
|||||||
|
|
||||||
export class CreateGroupDto {
|
export class CreateGroupDto {
|
||||||
@MinLength(2)
|
@MinLength(2)
|
||||||
@MaxLength(50)
|
@MaxLength(100)
|
||||||
@IsString()
|
@IsString()
|
||||||
@Transform(({ value }: TransformFnParams) => value?.trim())
|
@Transform(({ value }: TransformFnParams) => value?.trim())
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {Transform, TransformFnParams} from "class-transformer";
|
|||||||
|
|
||||||
export class CreateSpaceDto {
|
export class CreateSpaceDto {
|
||||||
@MinLength(2)
|
@MinLength(2)
|
||||||
@MaxLength(50)
|
@MaxLength(100)
|
||||||
@IsString()
|
@IsString()
|
||||||
@Transform(({ value }: TransformFnParams) => value?.trim())
|
@Transform(({ value }: TransformFnParams) => value?.trim())
|
||||||
name: string;
|
name: string;
|
||||||
@@ -19,7 +19,7 @@ export class CreateSpaceDto {
|
|||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
@MinLength(2)
|
@MinLength(2)
|
||||||
@MaxLength(50)
|
@MaxLength(100)
|
||||||
@IsAlphanumeric()
|
@IsAlphanumeric()
|
||||||
slug: string;
|
slug: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user