diff --git a/libs/api/domains/signature-collection/src/lib/signatureCollection.resolver.ts b/libs/api/domains/signature-collection/src/lib/signatureCollection.resolver.ts index 058ef2387074..340f5c6170a9 100644 --- a/libs/api/domains/signature-collection/src/lib/signatureCollection.resolver.ts +++ b/libs/api/domains/signature-collection/src/lib/signatureCollection.resolver.ts @@ -31,6 +31,7 @@ import { SignatureCollectionSignedList, SignatureCollectionSignee, } from './models' +import { SignatureCollectionListSummary } from './models/areaSummaryReport.model' @UseGuards(IdsUserGuard, ScopesGuard, UserAccessGuard) @Resolver() @@ -207,4 +208,16 @@ export class SignatureCollectionResolver { signee.candidate?.id, ) } + + @Scopes(ApiScope.signatureCollection) + @IsOwner() + @AllowManager() + @Query(() => SignatureCollectionListSummary) + @Audit() + async signatureCollectionListOverview( + @CurrentUser() user: User, + @Args('input') input: SignatureCollectionListIdInput, + ): Promise { + return this.signatureCollectionService.listOverview(user, input.listId) + } } diff --git a/libs/api/domains/signature-collection/src/lib/signatureCollection.service.ts b/libs/api/domains/signature-collection/src/lib/signatureCollection.service.ts index b714b5f2d10e..7bafbcbc7207 100644 --- a/libs/api/domains/signature-collection/src/lib/signatureCollection.service.ts +++ b/libs/api/domains/signature-collection/src/lib/signatureCollection.service.ts @@ -18,6 +18,7 @@ import { SignatureCollectionAddListsInput } from './dto/addLists.input' import { SignatureCollectionUploadPaperSignatureInput } from './dto/uploadPaperSignature.input' import { SignatureCollectionCanSignFromPaperInput } from './dto/canSignFromPaper.input' import { SignatureCollectionCollector } from './models/collector.model' +import { SignatureCollectionListSummary } from './models/areaSummaryReport.model' @Injectable() export class SignatureCollectionService { @@ -187,4 +188,14 @@ export class SignatureCollectionService { candidateId, ) } + + async listOverview( + user: User, + listId: string, + ): Promise { + return await this.signatureCollectionClientService.getListOverview( + user, + listId, + ) + } } diff --git a/libs/clients/signature-collection/src/clientConfig.json b/libs/clients/signature-collection/src/clientConfig.json index fe45f37d9a21..e6f3ad6b4575 100644 --- a/libs/clients/signature-collection/src/clientConfig.json +++ b/libs/clients/signature-collection/src/clientConfig.json @@ -1076,6 +1076,41 @@ } } }, + "/Medmaelalistar/{ID}/Info": { + "get": { + "tags": ["Medmaelalistar"], + "summary": "Skilar yfirliti fyrir ákveðinn meðmælalista", + "description": "Framboð geta sótt yfirlit fyrir sína eigin lista", + "parameters": [ + { + "name": "ID", + "in": "path", + "description": "ID meðmælalista", + "required": true, + "schema": { "type": "integer", "format": "int32" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MedmaelalistiExtendedDTO" + } + } + } + }, + "204": { "description": "No Content" }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { "schema": { "type": "string" } } + } + } + } + } + }, "/Medmaelalistar/{ID}/Medmaeli": { "get": { "tags": ["Medmaelalistar"], diff --git a/libs/clients/signature-collection/src/lib/signature-collection.service.ts b/libs/clients/signature-collection/src/lib/signature-collection.service.ts index 8e74cf8d434c..a94a6dfebe91 100644 --- a/libs/clients/signature-collection/src/lib/signature-collection.service.ts +++ b/libs/clients/signature-collection/src/lib/signature-collection.service.ts @@ -23,6 +23,7 @@ import { mapCandidate } from './types/candidate.dto' import { Slug } from './types/slug.dto' import { Auth, AuthMiddleware, User } from '@island.is/auth-nest-tools' import { SignatureCollectionSharedClientService } from './signature-collection-shared.service' +import { ListSummary, mapListSummary } from './types/areaSummaryReport.dto' type Api = MedmaelalistarApi | MedmaelasofnunApi | MedmaeliApi | FrambodApi @Injectable() @@ -561,4 +562,15 @@ export class SignatureCollectionClientService { })) ?? [] ) } + + async getListOverview(auth: User, listId: string): Promise { + const summary = await this.getApiWithAuth( + this.listsApi, + auth, + ).medmaelalistarIDInfoGet({ + iD: parseInt(listId), + }) + + return mapListSummary(summary) + } }