feat: Organization services

This commit is contained in:
sauravdhakal12
2026-02-22 15:47:45 +05:45
parent f4c9174752
commit afed1731d2
42 changed files with 862 additions and 17 deletions

View File

@@ -24,7 +24,12 @@ export class HttpExceptionFilter implements ExceptionFilter<HttpException> {
});
}
if (status === 404) {
exception.message = `${exception.message} not found`;
}
response.status(status).json({
success: false,
message: exception.message,
statusCode: status,
});

View File

@@ -6,7 +6,7 @@ import {
} from '@nestjs/common';
import { DataResponse, MessageResponse } from 'common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { catchError, map } from 'rxjs/operators';
@Injectable()
export class ResponseInterceptor<T> implements NestInterceptor<T, any> {

View File

@@ -0,0 +1,26 @@
import {
registerDecorator,
ValidationArguments,
ValidationOptions,
} from 'class-validator';
export function AtLeastOneField(validationOptions?: ValidationOptions) {
return function (constructor: Function) {
registerDecorator({
name: 'atLeastOneField',
target: constructor,
propertyName: undefined as any, // important for class-level
options: validationOptions,
validator: {
validate(_: any, args: ValidationArguments) {
const object = args.object as Record<string, any>;
return Object.values(object).some((value) => value !== undefined);
},
defaultMessage() {
return 'At least one field must be provided';
},
},
});
};
}

View File

@@ -0,0 +1 @@
export * from './at-least-one-field';

View File

@@ -0,0 +1,6 @@
import { IsUUID } from 'class-validator';
export class UUIDQueryDTO {
@IsUUID()
id: string;
}