diff --git a/Common/Server/Middleware/ProjectAuthorization.ts b/Common/Server/Middleware/ProjectAuthorization.ts index 4a9ccc830f..79ca3192dd 100644 --- a/Common/Server/Middleware/ProjectAuthorization.ts +++ b/Common/Server/Middleware/ProjectAuthorization.ts @@ -94,9 +94,9 @@ export default class ProjectMiddleware { props: { isRoot: true }, }); - tenantId = apiKeyModel?.projectId || null; + tenantId = apiKeyModel?.projectId || null; - if(!tenantId) { + if (!tenantId) { throw new BadDataException( "Project ID not found for the provided API Key.", ); diff --git a/Common/Server/Utils/OpenAPI.ts b/Common/Server/Utils/OpenAPI.ts index 941cac63a8..2c3e213781 100644 --- a/Common/Server/Utils/OpenAPI.ts +++ b/Common/Server/Utils/OpenAPI.ts @@ -532,9 +532,7 @@ export default class OpenAPIUtil { public static getDefaultApiHeaders(): Array< ParameterObject | ReferenceObject > { - return [ - - ]; + return []; } public static generateUpdateApiSpec(data: { diff --git a/Common/Utils/Schema/ModelSchema.ts b/Common/Utils/Schema/ModelSchema.ts index 503fec1d45..52dca9d86e 100644 --- a/Common/Utils/Schema/ModelSchema.ts +++ b/Common/Utils/Schema/ModelSchema.ts @@ -35,7 +35,7 @@ export class ModelSchema extends BaseSchema { * Format permissions array into a human-readable string for OpenAPI documentation */ private static formatPermissionsForSchema( - permissions: Array | undefined + permissions: Array | undefined, ): string { if (!permissions || permissions.length === 0) { return "No access - you don't have permission for this operation"; @@ -49,7 +49,7 @@ export class ModelSchema extends BaseSchema { */ private static getColumnPermissionsDescription( model: DatabaseBaseModel, - key: string + key: string, ): string { const accessControl: ColumnAccessControl | undefined = model.getColumnAccessControlForAllColumns()[key]; @@ -59,13 +59,13 @@ export class ModelSchema extends BaseSchema { } const createPermissions: string = this.formatPermissionsForSchema( - accessControl.create + accessControl.create, ); const readPermissions: string = this.formatPermissionsForSchema( - accessControl.read + accessControl.read, ); const updatePermissions: string = this.formatPermissionsForSchema( - accessControl.update + accessControl.update, ); return `Permissions - Create: [${createPermissions}], Read: [${readPermissions}], Update: [${updatePermissions}]`; @@ -285,7 +285,7 @@ export class ModelSchema extends BaseSchema { return ModelSchema.getModelSchema({ modelType: entityArrayType as new () => DatabaseBaseModel, }); - }) + }), ) .openapi({ type: "array", @@ -348,8 +348,8 @@ export class ModelSchema extends BaseSchema { `Model schema for ${model.tableName} created with shape: ${JSON.stringify( shape, null, - 2 - )}` + 2, + )}`, ); return schema; @@ -394,7 +394,7 @@ export class ModelSchema extends BaseSchema { }, getOperatorSchema: ( operatorType: string, - columnType: TableColumnType + columnType: TableColumnType, ) => { return this.getOperatorSchema(operatorType, columnType); }, @@ -408,7 +408,7 @@ export class ModelSchema extends BaseSchema { } private static getValidOperatorsForColumnType( - columnType: TableColumnType + columnType: TableColumnType, ): Array { const commonOperators: Array = [ "EqualTo", @@ -483,7 +483,7 @@ export class ModelSchema extends BaseSchema { private static getOperatorSchema( operatorType: string, - columnType: TableColumnType + columnType: TableColumnType, ): ZodTypes.ZodTypeAny { const baseValue: ZodTypes.ZodTypeAny = this.getBaseValueSchemaForColumnType(columnType); @@ -540,7 +540,7 @@ export class ModelSchema extends BaseSchema { } private static getBaseValueSchemaForColumnType( - columnType: TableColumnType + columnType: TableColumnType, ): ZodTypes.ZodTypeAny { switch (columnType) { case TableColumnType.ObjectID: @@ -740,7 +740,7 @@ export class ModelSchema extends BaseSchema { private static getExampleValueForColumn( columnType: TableColumnType, - isSecondValue: boolean = false + isSecondValue: boolean = false, ): unknown { switch (columnType) { case TableColumnType.ObjectID: @@ -783,7 +783,7 @@ export class ModelSchema extends BaseSchema { } private static getQuerySchemaExample( - modelType: new () => DatabaseBaseModel + modelType: new () => DatabaseBaseModel, ): SchemaExample { const model: DatabaseBaseModel = new modelType(); const columns: Dictionary = getTableColumns(model); @@ -803,7 +803,7 @@ export class ModelSchema extends BaseSchema { } const validOperators: Array = this.getValidOperatorsForColumnType( - column.type + column.type, ); if (validOperators.length === 0) { continue; @@ -870,11 +870,11 @@ export class ModelSchema extends BaseSchema { } private static getSelectSchemaExample( - modelType: new () => DatabaseBaseModel + modelType: new () => DatabaseBaseModel, ): SchemaExample { if (!modelType) { throw new BadDataException( - "Model type is required to generate select schema example." + "Model type is required to generate select schema example.", ); } @@ -919,11 +919,11 @@ export class ModelSchema extends BaseSchema { } private static getGroupBySchemaExample( - modelType: new () => DatabaseBaseModel + modelType: new () => DatabaseBaseModel, ): SchemaExample { if (!modelType) { throw new BadDataException( - "Model type is required to generate group by schema example." + "Model type is required to generate group by schema example.", ); } @@ -1055,7 +1055,7 @@ export class ModelSchema extends BaseSchema { let zodType: ZodTypes.ZodTypeAny = this.getZodTypeForColumn( column, key, - data.schemaType + data.schemaType, ); // Make fields optional if specified @@ -1082,8 +1082,8 @@ export class ModelSchema extends BaseSchema { `${data.schemaType} model schema for ${model.tableName} created with shape: ${JSON.stringify( shape, null, - 2 - )}` + 2, + )}`, ); return schema; @@ -1093,7 +1093,7 @@ export class ModelSchema extends BaseSchema { private static getZodTypeForColumn( column: TableColumnMetadata, key: string, - schemaType: "create" | "read" | "update" | "delete" + schemaType: "create" | "read" | "update" | "delete", ): ZodTypes.ZodTypeAny { let zodType: ZodTypes.ZodTypeAny; @@ -1294,7 +1294,7 @@ export class ModelSchema extends BaseSchema { return schemaMethod({ modelType: entityArrayType as new () => DatabaseBaseModel, }); - }) + }), ) .openapi({ type: "array",