-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/fix-delegation-from
- Loading branch information
Showing
43 changed files
with
1,619 additions
and
211 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
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
11 changes: 0 additions & 11 deletions
11
libs/api/domains/signature-collection/src/lib/decorators/acessRequirement.decorator.ts
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
libs/api/domains/signature-collection/src/lib/decorators/allowDelegation.decorator.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,4 @@ | ||
import { SetMetadata } from '@nestjs/common' | ||
import { ALLOW_DELEGATION_KEY } from '../guards/constants' | ||
|
||
export const AllowDelegation = () => SetMetadata(ALLOW_DELEGATION_KEY, true) |
16 changes: 16 additions & 0 deletions
16
libs/api/domains/signature-collection/src/lib/decorators/index.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,16 @@ | ||
import { IsOwner } from './isOwner.decorator' | ||
import { CurrentSignee, getCurrentSignee } from './signee.decorator' | ||
import { AllowDelegation } from './allowDelegation.decorator' | ||
import { | ||
AllowManager, | ||
RestrictGuarantor, | ||
} from './parliamentaryUserTypes.decorator' | ||
|
||
export { | ||
AllowDelegation, | ||
CurrentSignee, | ||
IsOwner, | ||
getCurrentSignee, | ||
AllowManager, | ||
RestrictGuarantor, | ||
} |
4 changes: 4 additions & 0 deletions
4
libs/api/domains/signature-collection/src/lib/decorators/isOwner.decorator.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,4 @@ | ||
import { SetMetadata } from '@nestjs/common' | ||
import { IS_OWNER_KEY } from '../guards/constants' | ||
|
||
export const IsOwner = () => SetMetadata(IS_OWNER_KEY, true) |
28 changes: 28 additions & 0 deletions
28
libs/api/domains/signature-collection/src/lib/decorators/parliamentaryUserTypes.decorator.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,28 @@ | ||
import { SetMetadata } from '@nestjs/common' | ||
import { | ||
ALLOW_DELEGATION_KEY, | ||
RESTRICT_GUARANTOR_KEY, | ||
} from '../guards/constants' | ||
// --------------- | ||
// ---Guarantor--- | ||
// --------------- | ||
// A guarantor is a user in the signature collection system, aimed at parliamentary collections. | ||
// A guarantor (is: Ábyrgðaraðili) defined by Þjóðskrá Íslands as one of the following : | ||
// - A holder of procuration | ||
// OR - A direct candidate in the party ballot | ||
|
||
export const RestrictGuarantor = () => SetMetadata(RESTRICT_GUARANTOR_KEY, true) | ||
|
||
// --------------- | ||
// ----Manager---- | ||
// --------------- | ||
// A manager is a user in the signature collection system, aimed at parliamentary collections. | ||
// A manager (is: Umsjónaraðili) defined by Þjóðskrá Íslands as one of the following: | ||
// - Individuals delegated to a company without having a procuration role | ||
// OR - Individuals delegated to a person (possibly a list owner) | ||
|
||
// This is the same as the allow_delegation rule so no new constants are needed | ||
export const AllowManager = () => SetMetadata(ALLOW_DELEGATION_KEY, true) | ||
|
||
// Assumptions: Guarantors have access to everything unless otherwise stated | ||
// Managers have access to nothing unless otherwise stated |
35 changes: 35 additions & 0 deletions
35
libs/api/domains/signature-collection/src/lib/dto/index.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,35 @@ | ||
import { SignatureCollectionAddListsInput } from './addLists.input' | ||
import { SignatureCollectionAreaInput } from './area.input' | ||
import { | ||
BulkUploadUser, | ||
SignatureCollectionListBulkUploadInput, | ||
} from './bulkUpload.input' | ||
import { SignatureCollectionCandidateIdInput } from './candidateId.input' | ||
import { SignatureCollectionCancelListsInput } from './cencelLists.input' | ||
import { SignatureCollectionIdInput } from './collectionId.input' | ||
import { SignatureCollectionExtendDeadlineInput } from './extendDeadline.input' | ||
import { SignatureCollectionListIdInput } from './listId.input' | ||
import { SignatureCollectionNationalIdInput } from './nationalId.input' | ||
import { SignatureCollectionOwnerInput } from './owner.input' | ||
import { SignatureCollectionSignatureIdInput } from './signatureId.input' | ||
import { SignatureCollectionListInput } from './singatureList.input' | ||
import { SignatureCollectionUploadPaperSignatureInput } from './uploadPaperSignature.input' | ||
import { SignatureCollectionCanSignFromPaperInput } from './canSignFromPaper.input' | ||
|
||
export { | ||
SignatureCollectionAddListsInput, | ||
SignatureCollectionAreaInput, | ||
SignatureCollectionListBulkUploadInput, | ||
BulkUploadUser, | ||
SignatureCollectionCandidateIdInput, | ||
SignatureCollectionCancelListsInput, | ||
SignatureCollectionIdInput, | ||
SignatureCollectionExtendDeadlineInput, | ||
SignatureCollectionListIdInput, | ||
SignatureCollectionNationalIdInput, | ||
SignatureCollectionOwnerInput, | ||
SignatureCollectionSignatureIdInput, | ||
SignatureCollectionListInput, | ||
SignatureCollectionUploadPaperSignatureInput, | ||
SignatureCollectionCanSignFromPaperInput, | ||
} |
10 changes: 10 additions & 0 deletions
10
libs/api/domains/signature-collection/src/lib/dto/signatureUpdate.input.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,10 @@ | ||
import { IsNumber } from 'class-validator' | ||
import { Field, InputType } from '@nestjs/graphql' | ||
import { SignatureCollectionSignatureIdInput } from './signatureId.input' | ||
|
||
@InputType() | ||
export class SignatureCollectionSignatureUpdateInput extends SignatureCollectionSignatureIdInput { | ||
@Field() | ||
@IsNumber() | ||
pageNumber!: number | ||
} |
3 changes: 3 additions & 0 deletions
3
libs/api/domains/signature-collection/src/lib/guards/constants.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,3 @@ | ||
export const IS_OWNER_KEY = 'is-owner' | ||
export const ALLOW_DELEGATION_KEY = 'allow-delegation' | ||
export const RESTRICT_GUARANTOR_KEY = 'restrict-guarantor' |
Oops, something went wrong.