Skip to content

Remove unused fields from API Responses #964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion apps/api/src/app/column/column.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { ApiTags, ApiBody, ApiOperation, ApiSecurity } from '@nestjs/swagger';
import { Controller, Put, Param, Body, UseGuards, Post, Delete } from '@nestjs/common';
import {
Controller,
Put,
Param,
Body,
UseGuards,
Post,
Delete,
ClassSerializerInterceptor,
UseInterceptors,
} from '@nestjs/common';
import { ValidateMongoId } from '@shared/validations/valid-mongo-id.validation';

import { ACCESS_KEY_NAME } from '@impler/shared';
Expand All @@ -13,6 +23,7 @@ import { UpdateColumnCommand } from './commands/update-column.command';
@ApiTags('Column')
@UseGuards(JwtAuthGuard)
@ApiSecurity(ACCESS_KEY_NAME)
@UseInterceptors(ClassSerializerInterceptor)
export class ColumnController {
constructor(
private addColumn: AddColumn,
Expand Down
13 changes: 12 additions & 1 deletion apps/api/src/app/mapping/mapping.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { Body, Controller, Get, Param, ParseArrayPipe, Post, UseGuards } from '@nestjs/common';
import {
Body,
ClassSerializerInterceptor,
Controller,
Get,
Param,
ParseArrayPipe,
Post,
UseGuards,
UseInterceptors,
} from '@nestjs/common';
import { ApiTags, ApiSecurity, ApiOperation, ApiBody } from '@nestjs/swagger';
import { ACCESS_KEY_NAME, Defaults, ITemplateSchemaItem, UploadStatusEnum } from '@impler/shared';

Expand All @@ -22,6 +32,7 @@ import {
@ApiTags('Mappings')
@ApiSecurity(ACCESS_KEY_NAME)
@UseGuards(JwtAuthGuard)
@UseInterceptors(ClassSerializerInterceptor)
export class MappingController {
constructor(
private getUpload: GetUpload,
Expand Down
16 changes: 15 additions & 1 deletion apps/api/src/app/project/project.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import { Response } from 'express';
import { ApiOperation, ApiTags, ApiOkResponse, ApiSecurity } from '@nestjs/swagger';
import { Body, Controller, Delete, Get, Param, Post, Put, Query, Res, UseGuards } from '@nestjs/common';
import {
Body,
ClassSerializerInterceptor,
Controller,
Delete,
Get,
Param,
Post,
Put,
Query,
Res,
UseGuards,
UseInterceptors,
} from '@nestjs/common';

import { ACCESS_KEY_NAME, Defaults, IJwtPayload, PaginationResult, UserRolesEnum } from '@impler/shared';
import { UserSession } from '@shared/framework/user.decorator';
Expand Down Expand Up @@ -32,6 +45,7 @@ import { EnvironmentResponseDto } from 'app/environment/dtos/environment-respons
@ApiTags('Project')
@ApiSecurity(ACCESS_KEY_NAME)
@UseGuards(JwtAuthGuard)
@UseInterceptors(ClassSerializerInterceptor)
export class ProjectController {
constructor(
private getImports: GetImports,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/app/template/template.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FileInterceptor } from '@nestjs/platform-express';
import { ApiOperation, ApiTags, ApiOkResponse, ApiSecurity, ApiBody, ApiConsumes } from '@nestjs/swagger';
import {
Body,
ClassSerializerInterceptor,
Controller,
Delete,
Get,
Expand Down Expand Up @@ -70,6 +71,7 @@ import { ValidImportFile } from '@shared/validations/valid-import-file.validatio
@ApiTags('Template')
@ApiSecurity(ACCESS_KEY_NAME)
@UseGuards(JwtAuthGuard)
@UseInterceptors(ClassSerializerInterceptor)
export class TemplateController {
constructor(
private getUploads: GetUploads,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/app/upload/upload.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FileInterceptor } from '@nestjs/platform-express';
import { ACCESS_KEY_NAME, Defaults, UploadStatusEnum } from '@impler/shared';
import {
Body,
ClassSerializerInterceptor,
Controller,
Delete,
Get,
Expand Down Expand Up @@ -46,6 +47,7 @@ import {
@Controller('/upload')
@ApiSecurity(ACCESS_KEY_NAME)
@UseGuards(JwtAuthGuard)
@UseInterceptors(ClassSerializerInterceptor)
export class UploadController {
constructor(
private getAsset: GetAsset,
Expand Down
8 changes: 8 additions & 0 deletions libs/dal/src/repositories/column/column.entity.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Exclude } from 'class-transformer';

export class ColumnEntity {
_id?: string;

Expand Down Expand Up @@ -36,4 +38,10 @@ export class ColumnEntity {
defaultValue?: string | number;

validations?: any[];
@Exclude()
createdAt: Date;
@Exclude()
updatedAt: Date;
@Exclude()
__v?: number;
}
8 changes: 8 additions & 0 deletions libs/dal/src/repositories/mapping/mapping.entity.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Exclude } from 'class-transformer';

export class MappingEntity {
_id?: string;

Expand All @@ -6,4 +8,10 @@ export class MappingEntity {
_uploadId: string;

columnHeading: string;
@Exclude()
createdAt: Date;
@Exclude()
updatedAt: Date;
@Exclude()
__v?: number;
}
8 changes: 8 additions & 0 deletions libs/dal/src/repositories/project/project.entity.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Exclude } from 'class-transformer';

export class ProjectEntity {
_id?: string;

Expand All @@ -6,4 +8,10 @@ export class ProjectEntity {
_userId: string;

showBranding: boolean;
@Exclude()
createdAt: Date;
@Exclude()
updatedAt: Date;
@Exclude()
__v?: number;
}
8 changes: 8 additions & 0 deletions libs/dal/src/repositories/template/template.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DestinationsEnum, IntegrationEnum } from '@impler/shared';
import { Exclude } from 'class-transformer';

export class TemplateEntity {
_id?: string;
Expand All @@ -22,4 +23,11 @@ export class TemplateEntity {
imageColumns: string[];

integration: IntegrationEnum;

@Exclude()
createdAt: Date;
@Exclude()
updatedAt: Date;
@Exclude()
__v?: number;
}
9 changes: 9 additions & 0 deletions libs/dal/src/repositories/upload/upload.entity.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Exclude } from 'class-transformer';

export class UploadEntity {
_id?: string;

Expand Down Expand Up @@ -42,4 +44,11 @@ export class UploadEntity {
customChunkFormat: string;

headerRow: number;

@Exclude()
createdAt: Date;
@Exclude()
updatedAt: Date;
@Exclude()
__v?: number;
}