Fix serverless save when name empty (#6720)
- fix serverless function error on save when name empty - remove useless unique constraint on serverless function names
This commit is contained in:
@ -23,7 +23,6 @@ export class UpdateServerlessFunctionInput {
|
||||
description?: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@Field()
|
||||
code: string;
|
||||
}
|
||||
|
||||
@ -17,7 +17,6 @@ export enum ServerlessFunctionRuntime {
|
||||
}
|
||||
|
||||
@Entity('serverlessFunction')
|
||||
@Unique('IndexOnNameAndWorkspaceIdUnique', ['name', 'workspaceId'])
|
||||
export class ServerlessFunctionEntity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@ -240,18 +240,6 @@ export class ServerlessFunctionService extends TypeOrmQueryService<ServerlessFun
|
||||
code: FileUpload | string,
|
||||
workspaceId: string,
|
||||
) {
|
||||
const existingServerlessFunction =
|
||||
await this.serverlessFunctionRepository.findOne({
|
||||
where: { name: serverlessFunctionInput.name, workspaceId },
|
||||
});
|
||||
|
||||
if (existingServerlessFunction) {
|
||||
throw new ServerlessFunctionException(
|
||||
`Function already exists`,
|
||||
ServerlessFunctionExceptionCode.SERVERLESS_FUNCTION_ALREADY_EXIST,
|
||||
);
|
||||
}
|
||||
|
||||
let typescriptCode: string;
|
||||
|
||||
if (typeof code === 'string') {
|
||||
|
||||
Reference in New Issue
Block a user