mirror of
https://github.com/docmost/docmost.git
synced 2026-08-31 02:46:27 +08:00
feat: bases - WIP
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { IsUUID } from 'class-validator';
|
||||
|
||||
export class BaseIdDto {
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
|
||||
|
||||
export class CreateBaseDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
icon?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
pageId?: string;
|
||||
|
||||
@IsUUID()
|
||||
spaceId: string;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
IsIn,
|
||||
IsNotEmpty,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
} from 'class-validator';
|
||||
import { BASE_PROPERTY_TYPES } from '../base.schemas';
|
||||
|
||||
export class CreatePropertyDto {
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
|
||||
@IsIn(BASE_PROPERTY_TYPES)
|
||||
type: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
typeOptions?: Record<string, unknown>;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { IsObject, IsOptional, IsString, IsUUID } from 'class-validator';
|
||||
|
||||
export class CreateRowDto {
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
cells?: Record<string, unknown>;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
afterRowId?: string;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
IsIn,
|
||||
IsNotEmpty,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
} from 'class-validator';
|
||||
|
||||
export class CreateViewDto {
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsIn(['table', 'kanban', 'calendar'])
|
||||
type?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
config?: Record<string, unknown>;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
|
||||
|
||||
export class UpdateBaseDto {
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
icon?: string;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import {
|
||||
IsIn,
|
||||
IsNotEmpty,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
} from 'class-validator';
|
||||
import { BASE_PROPERTY_TYPES } from '../base.schemas';
|
||||
|
||||
export class UpdatePropertyDto {
|
||||
@IsUUID()
|
||||
propertyId: string;
|
||||
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsIn(BASE_PROPERTY_TYPES)
|
||||
type?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
typeOptions?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export class DeletePropertyDto {
|
||||
@IsUUID()
|
||||
propertyId: string;
|
||||
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
}
|
||||
|
||||
export class ReorderPropertyDto {
|
||||
@IsUUID()
|
||||
propertyId: string;
|
||||
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
position: string;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { IsNotEmpty, IsObject, IsOptional, IsString, IsUUID } from 'class-validator';
|
||||
|
||||
export class UpdateRowDto {
|
||||
@IsUUID()
|
||||
rowId: string;
|
||||
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
|
||||
@IsObject()
|
||||
cells: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export class DeleteRowDto {
|
||||
@IsUUID()
|
||||
rowId: string;
|
||||
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
}
|
||||
|
||||
export class RowIdDto {
|
||||
@IsUUID()
|
||||
rowId: string;
|
||||
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
}
|
||||
|
||||
export class ListRowsDto {
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
viewId?: string;
|
||||
}
|
||||
|
||||
export class ReorderRowDto {
|
||||
@IsUUID()
|
||||
rowId: string;
|
||||
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
position: string;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
IsIn,
|
||||
IsNotEmpty,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
} from 'class-validator';
|
||||
|
||||
export class UpdateViewDto {
|
||||
@IsUUID()
|
||||
viewId: string;
|
||||
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsIn(['table', 'kanban', 'calendar'])
|
||||
type?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
config?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export class DeleteViewDto {
|
||||
@IsUUID()
|
||||
viewId: string;
|
||||
|
||||
@IsUUID()
|
||||
baseId: string;
|
||||
}
|
||||
Reference in New Issue
Block a user