-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): integrate OpenAPI client generator for frontend
- Add OpenAPI CLI generator dependency for TypeScript-Axios library - Implement resource entity fetching with generated client - Update DTO types in NestJS server - Add client library generation instructions to README
- Loading branch information
jimmypalelil
committed
Jan 29, 2025
1 parent
d8de089
commit fde2ae1
Showing
19 changed files
with
2,797 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
backend/src/recreation-resource/dto/paginated-recreation-resouce.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
import { RecreationResourceDto } from "./recreation-resource.dto"; | ||
|
||
export class PaginatedRecreationResourceDto { | ||
@ApiProperty({ type: [RecreationResourceDto] }) | ||
data: RecreationResourceDto[]; | ||
|
||
@ApiProperty() | ||
total: number; | ||
|
||
@ApiProperty() | ||
page: number; | ||
} |
67 changes: 52 additions & 15 deletions
67
backend/src/recreation-resource/dto/recreation-resource.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,77 @@ | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
|
||
export class RecreationActivityDto { | ||
@ApiProperty({ | ||
description: "Unique code identifying the recreation activity", | ||
example: "HIKING", | ||
}) | ||
recreation_activity_code: string; | ||
|
||
@ApiProperty({ | ||
description: "Detailed description of the activity", | ||
example: "Hiking trails available for all skill levels", | ||
}) | ||
description: string; | ||
} | ||
|
||
export class RecreationStatusDto { | ||
@ApiProperty({ | ||
description: "Status code of the resource", | ||
}) | ||
status_code: string; | ||
|
||
@ApiProperty({ | ||
description: "Additional status information", | ||
example: "Temporary closure due to weather conditions", | ||
nullable: true, | ||
}) | ||
comment: string; | ||
|
||
@ApiProperty({ | ||
description: "Detailed status description", | ||
example: "The facility is currently closed to visitors", | ||
}) | ||
description: string; | ||
} | ||
|
||
export class RecreationResourceDto { | ||
@ApiProperty({ | ||
description: "The ID of the Recreation Resource", | ||
description: "Unique identifier of the Recreation Resource", | ||
example: "rec-123-abc", | ||
format: "uuid", | ||
}) | ||
rec_resource_id: string; | ||
|
||
@ApiProperty({ | ||
description: "The name of the Recreation Resource", | ||
description: "Official name of the Recreation Resource", | ||
example: "Evergreen Valley Campground", | ||
minLength: 1, | ||
maxLength: 100, | ||
}) | ||
name: string; | ||
|
||
@ApiProperty({ | ||
description: "The description of the Recreation Resource", | ||
description: "Detailed description of the Recreation Resource", | ||
example: "A scenic campground nestled in the heart of Evergreen Valley", | ||
nullable: true, | ||
}) | ||
description: string; | ||
|
||
@ApiProperty({ | ||
description: "The location of the Recreation Resource", | ||
description: "Physical location of the Recreation Resource", | ||
example: "123 Forest Road, Mountain View, CA 94043", | ||
}) | ||
site_location: string; | ||
|
||
@ApiProperty({ | ||
description: "The list of available activities at the Recreation Resource", | ||
description: "List of recreational activities available at this resource", | ||
type: [RecreationActivityDto], | ||
}) | ||
recreation_activity: { | ||
recreation_activity_code: string; | ||
description: string; | ||
}[]; | ||
recreation_activity: RecreationActivityDto[]; | ||
|
||
@ApiProperty({ | ||
description: "The status of the Recreation Resource", | ||
description: "Current operational status of the Recreation Resource", | ||
type: RecreationStatusDto, | ||
}) | ||
recreation_status: { | ||
status_code: string; | ||
comment: string; | ||
description: string; | ||
}; | ||
recreation_status: RecreationStatusDto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", | ||
"spaces": 2, | ||
"generator-cli": { | ||
"version": "7.11.0" | ||
} | ||
} |
Oops, something went wrong.