diff --git a/src/app.module.ts b/src/app.module.ts index ce3bdf25..ae137d59 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -31,6 +31,7 @@ import { CohortMembersModule } from "./cohortMembers/cohortMembers.module"; import { FieldsModule } from "./fields/fields.module"; import { AuthModule } from "./auth/auth.module"; import { DatabaseModule } from "./common/database.module"; +import { SwaggerModule } from "@nestjs/swagger"; // Below modules no longer required in Shiksha 2.0 // import { GroupModule } from "./group/group.module"; // import { GroupMembershipModule } from "./groupMembership/groupMembership.module"; @@ -42,8 +43,8 @@ import { DatabaseModule } from "./common/database.module"; MulterModule.register({ dest: "./uploads", }), - UserModule, SchoolModule, + UserModule, RoleModule, AttendanceModule, HolidayModule, diff --git a/src/main.ts b/src/main.ts index a41bc669..994a3676 100644 --- a/src/main.ts +++ b/src/main.ts @@ -45,30 +45,19 @@ async function bootstrap() { exclude: [{ path: "health", method: RequestMethod.GET }], }); + const config = new DocumentBuilder() + .setTitle("Shiksha Platform") + .setDescription("CRUD API") + .setVersion("1.0") + .addTag("V1") + .addApiKey( + { type: "apiKey", name: "Authorization", in: "header" }, + "access-token" + ) - // const config = new DocumentBuilder() - // .setTitle("Shiksha Platform") - // .setDescription("CRUD API") - // .setVersion("1.0") - // .addTag("V1") - // .addApiKey( - // { type: "apiKey", name: "Authorization", in: "header" }, - // "access-token" - // ) - - // const config = new DocumentBuilder() - // .setTitle("Shiksha Platform") - // .setDescription("CRUD API") - // .setVersion("1.0") - // .addTag("V1") - // .addApiKey( - // { type: "apiKey", name: "Authorization", in: "header" }, - // "access-token" - // ) - - // .build(); - // const document = SwaggerModule.createDocument(app, config); - // SwaggerModule.setup("api/swagger-docs", app, document); + .build(); + const document = SwaggerModule.createDocument(app, config); + SwaggerModule.setup("api/swagger-docs", app, document); app.enableCors(); await app.listen(3000); } diff --git a/src/user/dto/user-create.dto.ts b/src/user/dto/user-create.dto.ts index 992efe77..8589b24c 100644 --- a/src/user/dto/user-create.dto.ts +++ b/src/user/dto/user-create.dto.ts @@ -6,6 +6,7 @@ import { IsString, IsNumber, } from "class-validator"; +import { User } from "../entities/user-entity"; import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; export class UserCreateDto { @@ -15,10 +16,7 @@ export class UserCreateDto { @Expose() userId: string; - @ApiProperty({ - type: String, - description: "The username of the user", - }) + @ApiProperty({ type: () => User }) @Expose() username: string; diff --git a/src/user/dto/user-search.dto.ts b/src/user/dto/user-search.dto.ts index b9247ea2..7193420a 100644 --- a/src/user/dto/user-search.dto.ts +++ b/src/user/dto/user-search.dto.ts @@ -7,12 +7,10 @@ import { IsNumber, } from "class-validator"; import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; +import { User } from "../entities/user-entity"; export class UserSearchDto { - @ApiProperty({ - type: String, - description: "Limit", - }) + @ApiProperty({ type: () => User }) limit: string; @ApiProperty({