-
Notifications
You must be signed in to change notification settings - Fork 39
feat: application create and read refactor #5701
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a473b7e
feat: application create and read refactor
mcgarrye 33ca73e
Merge branch 'main' into 5147/msq-refactor-application-service
mcgarrye 2597cb5
Merge branch 'main' into 5147/msq-refactor-application-service
mcgarrye 54eb283
feat: update tests with new fields
mcgarrye e69531b
feat: fix typing error
mcgarrye 3e6c7da
Merge branch 'main' into 5147/msq-refactor-application-service
mcgarrye b4c0f71
Merge branch 'main' into 5147/msq-refactor-application-service
mcgarrye 1837c52
fix: flakey test
mcgarrye cdae353
fix: adjust flaky test
mcgarrye a12e534
fix: toContainEqual
mcgarrye 42fbfbf
Merge branch 'main' into 5147/msq-refactor-application-service
mcgarrye 52abbeb
feat: follow export standards
mcgarrye 8bdb897
Merge branch 'main' into 5147/msq-refactor-application-service
mcgarrye 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
11 changes: 11 additions & 0 deletions
11
api/prisma/migrations/42_application_selection_on_delete/migration.sql
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,11 @@ | ||
| -- DropForeignKey | ||
| ALTER TABLE "application_selection_options" DROP CONSTRAINT "application_selection_options_application_selection_id_fkey"; | ||
|
|
||
| -- DropForeignKey | ||
| ALTER TABLE "application_selections" DROP CONSTRAINT "application_selections_application_id_fkey"; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "application_selection_options" ADD CONSTRAINT "application_selection_options_application_selection_id_fkey" FOREIGN KEY ("application_selection_id") REFERENCES "application_selections"("id") ON DELETE CASCADE ON UPDATE NO ACTION; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "application_selections" ADD CONSTRAINT "application_selections_application_id_fkey" FOREIGN KEY ("application_id") REFERENCES "applications"("id") ON DELETE CASCADE ON UPDATE NO ACTION; |
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,17 @@ | ||
| import { Expose } from 'class-transformer'; | ||
| import { IsString, IsUUID } from 'class-validator'; | ||
| import { ApiPropertyOptional, OmitType } from '@nestjs/swagger'; | ||
| import { Address } from './address.dto'; | ||
| import { ValidationsGroupsEnum } from '../../enums/shared/validation-groups-enum'; | ||
|
|
||
| export class AddressUpdate extends OmitType(Address, [ | ||
| 'id', | ||
| 'createdAt', | ||
| 'updatedAt', | ||
| ]) { | ||
| @Expose() | ||
| @IsString({ groups: [ValidationsGroupsEnum.default] }) | ||
| @IsUUID(4, { groups: [ValidationsGroupsEnum.default] }) | ||
| @ApiPropertyOptional() | ||
| id?: string; | ||
| } |
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 |
|---|---|---|
| @@ -1,4 +1,23 @@ | ||
| import { OmitType } from '@nestjs/swagger'; | ||
| import { Expose, Type } from 'class-transformer'; | ||
| import { ArrayMaxSize, ValidateNested } from 'class-validator'; | ||
| import { ApiPropertyOptional, OmitType } from '@nestjs/swagger'; | ||
| import { ApplicationUpdate } from './application-update.dto'; | ||
| import ApplicationSelectionCreate from './application-selection-create.dto'; | ||
| import { ValidationsGroupsEnum } from '../../enums/shared/validation-groups-enum'; | ||
|
|
||
| export class ApplicationCreate extends OmitType(ApplicationUpdate, ['id']) {} | ||
| export class ApplicationCreate extends OmitType(ApplicationUpdate, [ | ||
| 'id', | ||
| 'applicationSelections', | ||
| ]) { | ||
| // TODO: Temporarily optional until after MSQ refactor | ||
| @Expose() | ||
| // @IsDefined({ groups: [ValidationsGroupsEnum.default] }) | ||
| @ArrayMaxSize(64, { groups: [ValidationsGroupsEnum.default] }) | ||
| @ValidateNested({ groups: [ValidationsGroupsEnum.default], each: true }) | ||
| @Type(() => ApplicationSelectionCreate) | ||
| @ApiPropertyOptional({ | ||
| type: ApplicationSelectionCreate, | ||
| isArray: true, | ||
| }) | ||
| applicationSelections?: ApplicationSelectionCreate[]; | ||
| } |
24 changes: 24 additions & 0 deletions
24
api/src/dtos/applications/application-selection-create.dto.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,24 @@ | ||
| import { ApiProperty, OmitType } from '@nestjs/swagger'; | ||
| import { Expose, Type } from 'class-transformer'; | ||
| import { IsDefined, ValidateNested } from 'class-validator'; | ||
| import ApplicationSelectionUpdate from './application-selection-update.dto'; | ||
| import ApplicationSelectionOptionCreate from './application-selection-option-create.dto'; | ||
| import { ValidationsGroupsEnum } from '../../enums/shared/validation-groups-enum'; | ||
|
|
||
| class ApplicationSelectionCreate extends OmitType(ApplicationSelectionUpdate, [ | ||
| 'id', | ||
| 'application', | ||
| 'selections', | ||
| ]) { | ||
| @Expose() | ||
| @IsDefined({ groups: [ValidationsGroupsEnum.default] }) | ||
| @ValidateNested({ groups: [ValidationsGroupsEnum.default], each: true }) | ||
| @Type(() => ApplicationSelectionOptionCreate) | ||
| @ApiProperty({ | ||
| type: ApplicationSelectionOptionCreate, | ||
| isArray: true, | ||
| }) | ||
| selections: ApplicationSelectionOptionCreate[]; | ||
| } | ||
|
|
||
| export { ApplicationSelectionCreate as default, ApplicationSelectionCreate }; | ||
12 changes: 12 additions & 0 deletions
12
api/src/dtos/applications/application-selection-option-create.dto.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,12 @@ | ||
| import { OmitType } from '@nestjs/swagger'; | ||
| import ApplicationSelectionOptionUpdate from './application-selection-option-update.dto'; | ||
|
|
||
| class ApplicationSelectionOptionCreate extends OmitType( | ||
| ApplicationSelectionOptionUpdate, | ||
| ['id'], | ||
| ) {} | ||
|
|
||
| export { | ||
| ApplicationSelectionOptionCreate as default, | ||
| ApplicationSelectionOptionCreate, | ||
| }; |
41 changes: 41 additions & 0 deletions
41
api/src/dtos/applications/application-selection-option-update.dto.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,41 @@ | ||
| import { ApiPropertyOptional, OmitType } from '@nestjs/swagger'; | ||
| import { Expose, Type } from 'class-transformer'; | ||
| import { IsString, IsUUID, ValidateNested } from 'class-validator'; | ||
| import ApplicationSelectionOption from './application-selection-option.dto'; | ||
| import { AddressUpdate } from '../addresses/address-update.dto'; | ||
| import { IdDTO } from '../shared/id.dto'; | ||
| import { ValidationsGroupsEnum } from '../../enums/shared/validation-groups-enum'; | ||
|
|
||
| class ApplicationSelectionOptionUpdate extends OmitType( | ||
| ApplicationSelectionOption, | ||
| [ | ||
| 'id', | ||
| 'createdAt', | ||
| 'updatedAt', | ||
| 'addressHolderAddress', | ||
| 'applicationSelection', | ||
| ], | ||
| ) { | ||
| @Expose() | ||
| @IsString({ groups: [ValidationsGroupsEnum.default] }) | ||
| @IsUUID(4, { groups: [ValidationsGroupsEnum.default] }) | ||
| @ApiPropertyOptional() | ||
| id?: string; | ||
|
|
||
| @Expose() | ||
| @ValidateNested({ groups: [ValidationsGroupsEnum.default] }) | ||
| @Type(() => AddressUpdate) | ||
| @ApiPropertyOptional({ type: AddressUpdate }) | ||
| addressHolderAddress?: AddressUpdate; | ||
|
|
||
| @Expose() | ||
| @ValidateNested({ groups: [ValidationsGroupsEnum.default] }) | ||
| @Type(() => IdDTO) | ||
| @ApiPropertyOptional({ type: IdDTO }) | ||
| applicationSelection?: IdDTO; | ||
| } | ||
|
|
||
| export { | ||
| ApplicationSelectionOptionUpdate as default, | ||
| ApplicationSelectionOptionUpdate, | ||
| }; |
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
31 changes: 31 additions & 0 deletions
31
api/src/dtos/applications/application-selection-update.dto.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,31 @@ | ||
| import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger'; | ||
| import { Expose, Type } from 'class-transformer'; | ||
| import { IsDefined, IsString, IsUUID, ValidateNested } from 'class-validator'; | ||
| import ApplicationSelection from './application-selection.dto'; | ||
| import ApplicationSelectionOptionUpdate from './application-selection-option-update.dto'; | ||
| import { ValidationsGroupsEnum } from '../../enums/shared/validation-groups-enum'; | ||
|
|
||
| class ApplicationSelectionUpdate extends OmitType(ApplicationSelection, [ | ||
| 'id', | ||
| 'createdAt', | ||
| 'updatedAt', | ||
| 'selections', | ||
| ]) { | ||
| @Expose() | ||
| @IsString({ groups: [ValidationsGroupsEnum.default] }) | ||
| @IsUUID(4, { groups: [ValidationsGroupsEnum.default] }) | ||
| @ApiPropertyOptional() | ||
| id?: string; | ||
|
|
||
| @Expose() | ||
| @IsDefined({ groups: [ValidationsGroupsEnum.default] }) | ||
| @ValidateNested({ groups: [ValidationsGroupsEnum.default], each: true }) | ||
| @Type(() => ApplicationSelectionOptionUpdate) | ||
| @ApiProperty({ | ||
| type: ApplicationSelectionOptionUpdate, | ||
| isArray: true, | ||
| }) | ||
| selections: ApplicationSelectionOptionUpdate[]; | ||
| } | ||
|
|
||
| export { ApplicationSelectionUpdate as default, ApplicationSelectionUpdate }; |
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
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.