-
Notifications
You must be signed in to change notification settings - Fork 1
feat: updated geospatial section #1745
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
ayeshmcg
wants to merge
7
commits into
main
Choose a base branch
from
feat/orca-1015-geospatial-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a83bfb6
feat: updated geospatial section
ayeshmcg ca0252a
chore: added requested changes
ayeshmcg 9497841
chore: fixed geospatial section
ayeshmcg a332a5b
chore: fixed migrations
ayeshmcg 7bf0a71
chore: fixed bucket name
ayeshmcg 8d304a6
chore: fixed
ayeshmcg 3c10dc4
chore: fixed fixture
ayeshmcg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,92 @@ | ||
| import { ApiProperty } from '@nestjs/swagger'; | ||
| import { IsNotEmpty, IsNumber, IsString } from 'class-validator'; | ||
|
|
||
| export class ExhibitADocDto { | ||
| @ApiProperty({ | ||
| description: 'Document UUID', | ||
| example: 'a7c1e5f3-8d2b-4c9a-b1e6-f3d8c7a2e5b9', | ||
| }) | ||
| document_id: string; | ||
|
|
||
| @ApiProperty({ description: 'Recreation Resource ID', example: 'REC0001' }) | ||
| rec_resource_id: string; | ||
|
|
||
| @ApiProperty({ | ||
| description: 'File name without extension', | ||
| example: 'exhibit-a-2024', | ||
| }) | ||
| file_name: string; | ||
|
|
||
| @ApiProperty({ description: 'File extension', example: 'pdf' }) | ||
| extension: string; | ||
|
|
||
| @ApiProperty({ | ||
| description: 'File size in bytes', | ||
| example: 1024000, | ||
| required: false, | ||
| }) | ||
| file_size?: number; | ||
|
|
||
| @ApiProperty({ | ||
| description: 'S3 object key', | ||
| example: 'REC0001/exhibit-a-2024.pdf', | ||
| }) | ||
| s3_key: string; | ||
|
|
||
| @ApiProperty({ | ||
| description: 'Presigned download URL', | ||
| example: 'https://s3.amazonaws.com/...', | ||
| }) | ||
| url: string; | ||
|
|
||
| @ApiProperty({ | ||
| description: 'When the document was created', | ||
| required: false, | ||
| }) | ||
| created_at?: Date; | ||
| } | ||
|
|
||
| export class FinalizeExhibitAUploadRequestDto { | ||
| @ApiProperty({ | ||
| description: 'Document ID returned from presign endpoint', | ||
| example: 'a7c1e5f3-8d2b-4c9a-b1e6-f3d8c7a2e5b9', | ||
| }) | ||
| @IsNotEmpty() | ||
| @IsString() | ||
| document_id: string; | ||
|
|
||
| @ApiProperty({ | ||
| description: 'File name without extension', | ||
| example: 'exhibit-a-2024', | ||
| }) | ||
| @IsNotEmpty() | ||
| @IsString() | ||
| file_name: string; | ||
|
|
||
| @ApiProperty({ description: 'File extension without dot', example: 'pdf' }) | ||
| @IsNotEmpty() | ||
| @IsString() | ||
| extension: string; | ||
|
|
||
| @ApiProperty({ description: 'File size in bytes', example: 2097152 }) | ||
| @IsNotEmpty() | ||
| @IsNumber() | ||
| file_size: number; | ||
| } | ||
|
|
||
| export class PresignExhibitAUploadResponseDto { | ||
| @ApiProperty({ | ||
| description: 'Allocated document ID (UUID)', | ||
| example: 'a7c1e5f3-8d2b-4c9a-b1e6-f3d8c7a2e5b9', | ||
| }) | ||
| document_id: string; | ||
|
|
||
| @ApiProperty({ | ||
| description: 'S3 object key', | ||
| example: 'REC0001/a7c1e5f3-8d2b-4c9a-b1e6-f3d8c7a2e5b9/exhibit-a.pdf', | ||
| }) | ||
| key: string; | ||
|
|
||
| @ApiProperty({ description: 'Presigned PUT URL for uploading to S3' }) | ||
| url: string; | ||
| } |
159 changes: 159 additions & 0 deletions
159
admin/backend/src/exhibit-a-docs/exhibit-a-docs.controller.ts
This file contains hidden or 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,159 @@ | ||
| import { | ||
| AUTH_STRATEGY, | ||
| AuthRoles, | ||
| AuthRolesGuard, | ||
| RecreationResourceAuthRole, | ||
| ROLE_MODE, | ||
| SuperAdminGuard, | ||
| } from '@/auth'; | ||
| import { | ||
| Body, | ||
| Controller, | ||
| Delete, | ||
| Get, | ||
| Param, | ||
| Post, | ||
| Query, | ||
| UseGuards, | ||
| } from '@nestjs/common'; | ||
| import { AuthGuard } from '@nestjs/passport'; | ||
| import { | ||
| ApiBearerAuth, | ||
| ApiBody, | ||
| ApiOperation, | ||
| ApiParam, | ||
| ApiQuery, | ||
| ApiResponse, | ||
| ApiTags, | ||
| } from '@nestjs/swagger'; | ||
| import { | ||
| ExhibitADocDto, | ||
| FinalizeExhibitAUploadRequestDto, | ||
| PresignExhibitAUploadResponseDto, | ||
| } from './dto/exhibit-a-doc.dto'; | ||
| import { ExhibitADocsService } from './exhibit-a-docs.service'; | ||
|
|
||
| @ApiTags('recreation-resources') | ||
| @Controller({ | ||
| path: 'recreation-resources/:rec_resource_id/exhibit-a-docs', | ||
| version: '1', | ||
| }) | ||
| @ApiBearerAuth(AUTH_STRATEGY.KEYCLOAK) | ||
| @UseGuards(AuthGuard(AUTH_STRATEGY.KEYCLOAK), AuthRolesGuard) | ||
| @AuthRoles([RecreationResourceAuthRole.RST_ADMIN], ROLE_MODE.ALL) | ||
| export class ExhibitADocsController { | ||
| constructor(private readonly exhibitADocsService: ExhibitADocsService) {} | ||
|
|
||
| @AuthRoles( | ||
| [ | ||
| RecreationResourceAuthRole.RST_VIEWER, | ||
| RecreationResourceAuthRole.RST_ADMIN, | ||
| ], | ||
| ROLE_MODE.ANY, | ||
| ) | ||
| @Get() | ||
| @ApiOperation({ | ||
| operationId: 'getAllExhibitADocs', | ||
| summary: 'Get all Exhibit A documents for a recreation resource', | ||
| }) | ||
| @ApiParam({ | ||
| name: 'rec_resource_id', | ||
| description: 'Recreation Resource ID', | ||
| example: 'REC0001', | ||
| }) | ||
| @ApiResponse({ | ||
| status: 200, | ||
| description: 'List of Exhibit A documents', | ||
| type: [ExhibitADocDto], | ||
| }) | ||
| @ApiResponse({ status: 404, description: 'Recreation resource not found' }) | ||
| async getAll( | ||
| @Param('rec_resource_id') rec_resource_id: string, | ||
| ): Promise<ExhibitADocDto[]> { | ||
| return this.exhibitADocsService.getAll(rec_resource_id); | ||
| } | ||
|
|
||
| @UseGuards(SuperAdminGuard) | ||
| @Post('presign') | ||
| @ApiOperation({ | ||
| operationId: 'presignExhibitAUpload', | ||
| summary: 'Request presigned URL for direct S3 Exhibit A document upload', | ||
| }) | ||
| @ApiParam({ | ||
| name: 'rec_resource_id', | ||
| description: 'Recreation Resource ID', | ||
| example: 'REC0001', | ||
| }) | ||
| @ApiQuery({ | ||
| name: 'fileName', | ||
| required: true, | ||
| description: 'File name with extension', | ||
| example: 'exhibit-a.pdf', | ||
| }) | ||
| @ApiResponse({ | ||
| status: 200, | ||
| description: 'Presigned URL generated', | ||
| type: PresignExhibitAUploadResponseDto, | ||
| }) | ||
| @ApiResponse({ status: 404, description: 'Recreation Resource not found' }) | ||
| async presignUpload( | ||
| @Param('rec_resource_id') rec_resource_id: string, | ||
| @Query('fileName') fileName: string, | ||
| ): Promise<PresignExhibitAUploadResponseDto> { | ||
| return this.exhibitADocsService.presignUpload(rec_resource_id, fileName); | ||
| } | ||
|
|
||
| @UseGuards(SuperAdminGuard) | ||
| @Post('finalize') | ||
|
ayeshmcg marked this conversation as resolved.
|
||
| @ApiOperation({ | ||
| operationId: 'finalizeExhibitAUpload', | ||
| summary: 'Finalize Exhibit A document upload and create database record', | ||
| }) | ||
| @ApiParam({ | ||
| name: 'rec_resource_id', | ||
| description: 'Recreation Resource ID', | ||
| example: 'REC0001', | ||
| }) | ||
| @ApiBody({ required: true, type: FinalizeExhibitAUploadRequestDto }) | ||
| @ApiResponse({ | ||
| status: 200, | ||
| description: 'Document record created', | ||
| type: ExhibitADocDto, | ||
| }) | ||
| @ApiResponse({ status: 404, description: 'Recreation Resource not found' }) | ||
| async finalizeUpload( | ||
| @Param('rec_resource_id') rec_resource_id: string, | ||
| @Body() body: FinalizeExhibitAUploadRequestDto, | ||
| ): Promise<ExhibitADocDto> { | ||
| return this.exhibitADocsService.finalizeUpload(rec_resource_id, body); | ||
| } | ||
|
|
||
| @UseGuards(SuperAdminGuard) | ||
| @Delete(':document_id') | ||
|
ayeshmcg marked this conversation as resolved.
|
||
| @ApiOperation({ | ||
| operationId: 'deleteExhibitADoc', | ||
| summary: 'Delete an Exhibit A document', | ||
| }) | ||
| @ApiParam({ | ||
| name: 'rec_resource_id', | ||
| description: 'Recreation Resource ID', | ||
| example: 'REC0001', | ||
| }) | ||
| @ApiParam({ | ||
| name: 'document_id', | ||
| description: 'Document UUID', | ||
| example: 'a7c1e5f3-8d2b-4c9a-b1e6-f3d8c7a2e5b9', | ||
| }) | ||
| @ApiResponse({ | ||
| status: 200, | ||
| description: 'Document deleted', | ||
| type: ExhibitADocDto, | ||
| }) | ||
| @ApiResponse({ status: 404, description: 'Document not found' }) | ||
| async delete( | ||
| @Param('rec_resource_id') rec_resource_id: string, | ||
| @Param('document_id') document_id: string, | ||
| ): Promise<ExhibitADocDto> { | ||
| return this.exhibitADocsService.delete(rec_resource_id, document_id); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.