mirror of
https://github.com/docmost/docmost.git
synced 2025-11-24 21:31:08 +10:00
Refactoring
* Refactor workspace membership system * Create setup endpoint * Use Passport.js * Several updates and fixes
This commit is contained in:
15
apps/server/src/core/auth/dto/create-admin-user.dto.ts
Normal file
15
apps/server/src/core/auth/dto/create-admin-user.dto.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { IsNotEmpty, IsString, MaxLength, MinLength } from 'class-validator';
|
||||
import { CreateUserDto } from './create-user.dto';
|
||||
|
||||
export class CreateAdminUserDto extends CreateUserDto {
|
||||
@IsNotEmpty()
|
||||
@MinLength(3)
|
||||
@MaxLength(35)
|
||||
name: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@MinLength(4)
|
||||
@MaxLength(35)
|
||||
@IsString()
|
||||
workspaceName: string;
|
||||
}
|
||||
24
apps/server/src/core/auth/dto/create-user.dto.ts
Normal file
24
apps/server/src/core/auth/dto/create-user.dto.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import {
|
||||
IsEmail,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString, MaxLength,
|
||||
MinLength,
|
||||
} from 'class-validator';
|
||||
|
||||
export class CreateUserDto {
|
||||
@IsOptional()
|
||||
@MinLength(3)
|
||||
@MaxLength(35)
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@IsEmail()
|
||||
email: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@MinLength(8)
|
||||
@IsString()
|
||||
password: string;
|
||||
}
|
||||
16
apps/server/src/core/auth/dto/jwt-payload.ts
Normal file
16
apps/server/src/core/auth/dto/jwt-payload.ts
Normal file
@ -0,0 +1,16 @@
|
||||
export enum JwtType {
|
||||
ACCESS = 'access',
|
||||
REFRESH = 'refresh',
|
||||
}
|
||||
export type JwtPayload = {
|
||||
sub: string;
|
||||
email: string;
|
||||
workspaceId: string;
|
||||
type: 'access';
|
||||
};
|
||||
|
||||
export type JwtRefreshPayload = {
|
||||
sub: string;
|
||||
workspaceId: string;
|
||||
type: 'refresh';
|
||||
};
|
||||
Reference in New Issue
Block a user