-
-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(server): support recycle bin (#1396)
* feat(server): function templates add user avatar support * feat(server): add function recycle bin * add function recycle bin control * refactor recycle-bin * fix dependency and refactor recycle-bin entity * add transaction * chore * fix dependecy
- Loading branch information
Showing
16 changed files
with
495 additions
and
14 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
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
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
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
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
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
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
13 changes: 13 additions & 0 deletions
13
server/src/recycle-bin/cloud-function/dto/delete-recycle-bin-functions.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 { IsArray, IsNotEmpty, IsString } from 'class-validator' | ||
|
||
export class DeleteRecycleBinItemsDto { | ||
@ApiProperty({ | ||
description: 'The list of item ids', | ||
type: [String], | ||
}) | ||
@IsNotEmpty() | ||
@IsArray() | ||
@IsString({ each: true }) | ||
ids: string[] | ||
} |
76 changes: 76 additions & 0 deletions
76
server/src/recycle-bin/cloud-function/dto/get-recycle-bin-functions.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,76 @@ | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger' | ||
import { | ||
IsArray, | ||
IsIn, | ||
IsNotEmpty, | ||
IsString, | ||
Matches, | ||
MaxLength, | ||
} from 'class-validator' | ||
import { HTTP_METHODS } from 'src/constants' | ||
import { HttpMethod } from 'src/function/entities/cloud-function' | ||
|
||
class CloudFunctionSourceDto { | ||
@ApiProperty() | ||
code: string | ||
|
||
@ApiProperty() | ||
compiled: string | ||
|
||
@ApiPropertyOptional() | ||
uri?: string | ||
|
||
@ApiProperty() | ||
version: number | ||
|
||
@ApiPropertyOptional() | ||
hash?: string | ||
|
||
@ApiPropertyOptional() | ||
lang?: string | ||
} | ||
|
||
export class FunctionRecycleBinItemsDto { | ||
@ApiProperty() | ||
_id: string | ||
|
||
@ApiProperty() | ||
appid: string | ||
|
||
@ApiProperty({ | ||
description: 'Function name is unique in the application', | ||
}) | ||
@IsNotEmpty() | ||
@Matches(/^[a-zA-Z0-9_.\-\/]{1,256}$/) | ||
name: string | ||
|
||
@ApiProperty({ type: CloudFunctionSourceDto }) | ||
source: CloudFunctionSourceDto | ||
|
||
@ApiPropertyOptional() | ||
@MaxLength(256) | ||
description: string | ||
|
||
@ApiPropertyOptional({ type: [String] }) | ||
@IsString({ each: true }) | ||
@IsArray() | ||
@MaxLength(16, { each: true }) | ||
@IsNotEmpty({ each: true }) | ||
tags: string[] | ||
|
||
@ApiProperty({ type: [String], enum: HttpMethod }) | ||
@IsIn(HTTP_METHODS, { each: true }) | ||
methods: HttpMethod[] = [] | ||
|
||
@ApiPropertyOptional() | ||
params?: any | ||
|
||
@ApiProperty({ type: 'date' }) | ||
createdAt: Date | ||
|
||
@ApiProperty({ type: 'date' }) | ||
updatedAt: Date | ||
|
||
@ApiProperty() | ||
createdBy: string | ||
} |
13 changes: 13 additions & 0 deletions
13
server/src/recycle-bin/cloud-function/dto/restore-recycle-bin-functions.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 { IsArray, IsNotEmpty, IsString } from 'class-validator' | ||
|
||
export class RestoreRecycleBinItemsDto { | ||
@ApiProperty({ | ||
description: 'The list of item ids', | ||
type: [String], | ||
}) | ||
@IsNotEmpty() | ||
@IsArray() | ||
@IsString({ each: true }) | ||
ids: string[] | ||
} |
Oops, something went wrong.