-
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 j-s/subpoena-info
- Loading branch information
Showing
50 changed files
with
1,004 additions
and
226 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
22 changes: 22 additions & 0 deletions
22
apps/judicial-system/api/src/app/modules/event-log/dto/createEventLog.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,22 @@ | ||
import { Allow, IsOptional } from 'class-validator' | ||
|
||
import { Field, InputType } from '@nestjs/graphql' | ||
|
||
import { EventType } from '@island.is/judicial-system/types' | ||
|
||
@InputType() | ||
export class CreateEventLogInput { | ||
@Allow() | ||
@Field(() => EventType) | ||
readonly eventType!: EventType | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => String, { nullable: true }) | ||
readonly caseId?: string | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => String, { nullable: true }) | ||
readonly nationalId?: string | ||
} |
12 changes: 12 additions & 0 deletions
12
apps/judicial-system/api/src/app/modules/event-log/eventLog.config.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,12 @@ | ||
import { defineConfig } from '@island.is/nest/config' | ||
|
||
export const eventLogModuleConfig = defineConfig({ | ||
name: 'EventLogModule', | ||
load: (env) => ({ | ||
backendUrl: env.required('BACKEND_URL', 'http://localhost:3344'), | ||
secretToken: env.required( | ||
'BACKEND_ACCESS_TOKEN', | ||
'secret-backend-api-token', | ||
), | ||
}), | ||
}) |
8 changes: 8 additions & 0 deletions
8
apps/judicial-system/api/src/app/modules/event-log/eventLog.module.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,8 @@ | ||
import { Module } from '@nestjs/common' | ||
|
||
import { EventLogResolver } from './eventLog.resolver' | ||
|
||
@Module({ | ||
providers: [EventLogResolver], | ||
}) | ||
export class EventLogModule {} |
36 changes: 36 additions & 0 deletions
36
apps/judicial-system/api/src/app/modules/event-log/eventLog.resolver.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,36 @@ | ||
import { Inject, UseGuards } from '@nestjs/common' | ||
import { Args, Context, Mutation, Resolver } from '@nestjs/graphql' | ||
|
||
import type { Logger } from '@island.is/logging' | ||
import { LOGGER_PROVIDER } from '@island.is/logging' | ||
|
||
import { | ||
CurrentGraphQlUser, | ||
JwtGraphQlAuthGuard, | ||
} from '@island.is/judicial-system/auth' | ||
import type { User } from '@island.is/judicial-system/types' | ||
|
||
import { BackendApi } from '../../data-sources' | ||
import { CreateEventLogInput } from '../event-log/dto/createEventLog.input' | ||
|
||
@UseGuards(JwtGraphQlAuthGuard) | ||
@Resolver() | ||
export class EventLogResolver { | ||
constructor( | ||
@Inject(LOGGER_PROVIDER) | ||
private readonly logger: Logger, | ||
) {} | ||
|
||
@Mutation(() => Boolean, { nullable: true }) | ||
async createEventLog( | ||
@Args('input', { type: () => CreateEventLogInput }) | ||
input: CreateEventLogInput, | ||
@CurrentGraphQlUser() user: User, | ||
@Context('dataSources') { backendApi }: { backendApi: BackendApi }, | ||
): Promise<boolean> { | ||
this.logger.debug(`Creating event log for case ${input.caseId}`) | ||
|
||
const res = await backendApi.createEventLog(input, user.role) | ||
return res.ok | ||
} | ||
} |
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,2 @@ | ||
export { CreateEventLogInput } from './dto/createEventLog.input' | ||
export { EventLog } from './models/eventLog.model' |
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
14 changes: 4 additions & 10 deletions
14
apps/judicial-system/backend/src/app/modules/event-log/eventLog.controller.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
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
Oops, something went wrong.