Skip to content

Commit

Permalink
Merge pull request #88 from Shubham4026/shishka_main_testing
Browse files Browse the repository at this point in the history
Fixed Swagger Issue in Dev
  • Loading branch information
vijaykhollam authored Apr 1, 2024
2 parents 7bb6adb + ee25f07 commit 7e46118
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 32 deletions.
3 changes: 2 additions & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -42,8 +43,8 @@ import { DatabaseModule } from "./common/database.module";
MulterModule.register({
dest: "./uploads",
}),
UserModule,
SchoolModule,
UserModule,
RoleModule,
AttendanceModule,
HolidayModule,
Expand Down
35 changes: 12 additions & 23 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 2 additions & 4 deletions src/user/dto/user-create.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;

Expand Down
6 changes: 2 additions & 4 deletions src/user/dto/user-search.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 7e46118

Please sign in to comment.