-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
316 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { IsNotEmpty, IsUUID } from 'class-validator'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { WorkspaceInviteAttributes } from '../attributes/workspace-invite.attribute'; | ||
|
||
export class AcceptWorkspaceInviteDto { | ||
@ApiProperty({ | ||
example: '0f8fad5b-d9cb-469f-a165-70867728950e', | ||
description: 'id of the invitation', | ||
}) | ||
@IsUUID() | ||
@IsNotEmpty() | ||
inviteId: WorkspaceInviteAttributes['id']; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/modules/workspaces/dto/change-user-assigned-space.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsNotEmpty, IsPositive } from 'class-validator'; | ||
import { WorkspaceInvite } from '../domains/workspace-invite.domain'; | ||
|
||
export class ChangeUserAssignedSpaceDto { | ||
@ApiProperty({ | ||
example: '1073741824', | ||
description: 'New Space assigned to user in bytes', | ||
}) | ||
@IsNotEmpty() | ||
@IsPositive() | ||
spaceLimit: WorkspaceInvite['spaceLimit']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsNotEmpty, IsOptional } from 'class-validator'; | ||
import { WorkspaceTeam } from '../domains/workspace-team.domain'; | ||
|
||
export class CreateTeamDto { | ||
@ApiProperty({ | ||
example: 'Designers team', | ||
description: 'Name of the team to be created', | ||
}) | ||
@IsNotEmpty() | ||
name: WorkspaceTeam['name']; | ||
|
||
@ApiProperty({ | ||
example: 'e54c5cc0-3a12-4537-9646-251ec0f0dbe4', | ||
description: 'Uuid of the user to assign as manager', | ||
}) | ||
@IsOptional() | ||
managerId?: WorkspaceTeam['name']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { CreateFileDto } from '../../file/dto/create-file.dto'; | ||
|
||
export class CreateWorkspaceFileDto extends CreateFileDto {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsNotEmpty, IsUUID } from 'class-validator'; | ||
import { FolderAttributes } from '../../folder/folder.attributes'; | ||
|
||
export class CreateWorkspaceFolderDto { | ||
@ApiProperty({ | ||
example: 'Untitled Folder', | ||
description: 'Folder name', | ||
}) | ||
@IsNotEmpty() | ||
name: FolderAttributes['name']; | ||
|
||
@ApiProperty({ | ||
example: '79a88429-b45a-4ae7-90f1-c351b6882670', | ||
description: 'Uuid of the parent folder', | ||
}) | ||
@IsNotEmpty() | ||
@IsUUID('4') | ||
parentFolderUuid: FolderAttributes['uuid']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsNotEmpty, IsPositive } from 'class-validator'; | ||
import { User } from '../../user/user.domain'; | ||
import { WorkspaceInvite } from '../domains/workspace-invite.domain'; | ||
|
||
export class CreateWorkspaceInviteDto { | ||
@ApiProperty({ | ||
example: '[email protected]', | ||
description: 'The email of the user you want to invite', | ||
}) | ||
@IsNotEmpty() | ||
invitedUser: User['email']; | ||
|
||
@ApiProperty({ | ||
example: '1073741824', | ||
description: 'Space assigned to user in bytes', | ||
}) | ||
@IsNotEmpty() | ||
@IsPositive() | ||
spaceLimit: WorkspaceInvite['spaceLimit']; | ||
|
||
@ApiProperty({ | ||
example: 'encrypted encryption key', | ||
description: | ||
"Owner's encryption key encrypted with the invited user's public key.", | ||
}) | ||
@IsNotEmpty() | ||
encryptionKey: WorkspaceInvite['encryptionKey']; | ||
|
||
@ApiProperty({ | ||
example: 'Hello, join to my workspace', | ||
description: 'Message to include in the invitation.', | ||
}) | ||
message?: string; | ||
|
||
@ApiProperty({ | ||
example: 'aes-256-gcm', | ||
description: 'Encryption algorithm used to encrypt the encryption key.', | ||
}) | ||
@IsNotEmpty() | ||
encryptionAlgorithm: WorkspaceInvite['encryptionAlgorithm']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsNotEmpty, IsString } from 'class-validator'; | ||
import { WorkspaceTeam } from '../domains/workspace-team.domain'; | ||
|
||
export class EditTeamDto { | ||
@ApiProperty({ | ||
example: 'Designers team', | ||
description: 'New name of the team', | ||
}) | ||
@IsNotEmpty() | ||
@IsString() | ||
name: WorkspaceTeam['name']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsOptional, IsString, Length } from 'class-validator'; | ||
import { Workspace } from '../domains/workspaces.domain'; | ||
|
||
export class EditWorkspaceDetailsDto { | ||
@ApiProperty({ | ||
example: 'Internxt', | ||
description: 'Name of the workspace', | ||
}) | ||
@IsOptional() | ||
@IsString() | ||
@Length(3, 50) | ||
name?: Workspace['name']; | ||
|
||
@ApiProperty({ | ||
example: | ||
'Our goal is to create a cloud storage ecosystem that gives users total control, security, and privacy of the files and information online.', | ||
description: 'Description of the workspace', | ||
}) | ||
@IsOptional() | ||
@IsString() | ||
@Length(0, 150) | ||
description?: Workspace['description']; | ||
} |
42 changes: 42 additions & 0 deletions
42
src/modules/workspaces/dto/get-items-inside-shared-folder.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { IsOptional, IsString, IsInt, Min, Max } from 'class-validator'; | ||
import { Type } from 'class-transformer'; | ||
import { ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { OrderBy } from '../../../common/order.type'; | ||
|
||
export class GetItemsInsideSharedFolderDtoQuery { | ||
@ApiPropertyOptional({ | ||
description: 'Order by', | ||
example: 'name:asc', | ||
}) | ||
@IsOptional() | ||
@IsString() | ||
orderBy?: OrderBy; | ||
|
||
@ApiPropertyOptional({ | ||
description: 'Token', | ||
}) | ||
@IsOptional() | ||
@IsString() | ||
token?: string; | ||
|
||
@ApiPropertyOptional({ | ||
description: 'Page number', | ||
default: 0, | ||
}) | ||
@IsOptional() | ||
@IsInt() | ||
@Min(0) | ||
@Type(() => Number) | ||
page?: number = 0; | ||
|
||
@ApiPropertyOptional({ | ||
description: 'Items per page', | ||
default: 50, | ||
}) | ||
@IsOptional() | ||
@IsInt() | ||
@Min(1) | ||
@Max(50) | ||
@Type(() => Number) | ||
perPage?: number = 50; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Type } from 'class-transformer'; | ||
import { IsNumber, IsOptional, Max, Min } from 'class-validator'; | ||
|
||
export class PaginationQueryDto { | ||
@ApiProperty({ | ||
description: 'Items per page', | ||
example: 3, | ||
required: false, | ||
minimum: 0, | ||
maximum: 50, | ||
}) | ||
@IsOptional() | ||
@IsNumber() | ||
@Type(() => Number) | ||
@Min(0) | ||
@Max(50) | ||
limit?: number; | ||
|
||
@ApiProperty({ | ||
description: 'Offset for pagination', | ||
example: 0, | ||
required: false, | ||
minimum: 0, | ||
}) | ||
@IsOptional() | ||
@IsNumber() | ||
@Type(() => Number) | ||
@Min(0) | ||
offset?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsNotEmpty, IsOptional } from 'class-validator'; | ||
import { Workspace } from '../domains/workspaces.domain'; | ||
import { WorkspaceUserAttributes } from '../attributes/workspace-users.attributes'; | ||
|
||
export class SetupWorkspaceDto { | ||
@ApiProperty({ | ||
example: 'My workspace', | ||
description: 'Name of the workspace to be created', | ||
}) | ||
@IsOptional() | ||
name?: Workspace['name']; | ||
|
||
@ApiProperty({ | ||
example: 'Address', | ||
description: 'Address of the workspace', | ||
}) | ||
@IsOptional() | ||
address?: Workspace['address']; | ||
|
||
@ApiProperty({ | ||
example: 'My workspae', | ||
description: 'Workspace description', | ||
}) | ||
@IsOptional() | ||
description?: Workspace['description']; | ||
|
||
@ApiProperty({ | ||
example: 'Encrypted key in base64', | ||
description: 'Owner mnemnonic encrypted with their public key in base64', | ||
}) | ||
@IsNotEmpty() | ||
encryptedMnemonic: WorkspaceUserAttributes['key']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsNotEmpty } from 'class-validator'; | ||
import { WorkspaceItemUser } from '../domains/workspace-item-user.domain'; | ||
import { WorkspaceTeam } from '../domains/workspace-team.domain'; | ||
|
||
export class ShareItemWithTeamDto { | ||
@ApiProperty({ | ||
example: 'uuid', | ||
description: 'The uuid of the item to share', | ||
}) | ||
@IsNotEmpty() | ||
itemId: WorkspaceItemUser['itemId']; | ||
|
||
@ApiProperty({ | ||
example: 'file | folder', | ||
description: 'The type of the resource to share', | ||
}) | ||
@IsNotEmpty() | ||
itemType: WorkspaceItemUser['itemType']; | ||
|
||
@ApiProperty({ | ||
example: '84f47d08-dc7c-43dc-b27c-bec4edaa9598', | ||
description: "Workspace's team id you want to share this file with", | ||
}) | ||
@IsNotEmpty() | ||
sharedWith: WorkspaceTeam['id']; | ||
|
||
@ApiProperty({ | ||
example: '84f47d08-dc7c-43dc-b27c-bec4edaa9598', | ||
description: 'Role of the team regarding the item.', | ||
}) | ||
@IsNotEmpty() | ||
roleId: string; | ||
} |
28 changes: 28 additions & 0 deletions
28
src/modules/workspaces/dto/workspace-invitations-pagination.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Type } from 'class-transformer'; | ||
import { IsInt, Min, Max } from 'class-validator'; | ||
|
||
export class WorkspaceInvitationsPagination { | ||
@Type(() => Number) | ||
@IsInt() | ||
@Min(1) | ||
@Max(25) | ||
@ApiProperty({ | ||
example: 1, | ||
description: 'Number of items to request', | ||
required: true, | ||
type: Number, | ||
}) | ||
limit: number; | ||
|
||
@Type(() => Number) | ||
@IsInt() | ||
@Min(0) | ||
@ApiProperty({ | ||
example: 0, | ||
description: 'Number of items to skip', | ||
required: true, | ||
type: Number, | ||
}) | ||
offset: number; | ||
} |