Skip to content
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

feat(vehicles): HOTFIX - bulk mileage registration #16255

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions libs/api/domains/vehicles/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './lib/api-domains-vehicles.module'
export * from './lib/api-domains-vehicles.service'
export * from './lib/vehicles.module'
183 changes: 0 additions & 183 deletions libs/api/domains/vehicles/src/lib/api-domains-vehicles.type.ts

This file was deleted.

2 changes: 2 additions & 0 deletions libs/api/domains/vehicles/src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const ISLAND_IS_ORIGIN_CODE = 'ISLAND.IS'
export const LOG_CATEGORY = 'api-domains-vehicles'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Field, ID, InputType } from '@nestjs/graphql'

@InputType()
export class BulkVehicleMileageRequestOverviewInput {
@Field(() => ID)
guid!: string
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Field, ID, InputType } from '@nestjs/graphql'

@InputType()
export class BulkVehicleMileageRequestStatusInput {
@Field(() => ID)
requestId!: string
}
9 changes: 9 additions & 0 deletions libs/api/domains/vehicles/src/lib/dto/mileageReading.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface MileageReadingDto {
isEditing: boolean
canUserRegisterVehicleMileage?: boolean
readings: Array<{
date?: Date
origin?: string
mileage?: number
}>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Field, InputType } from '@nestjs/graphql'
import { IsInt, IsString } from 'class-validator'

@InputType()
export class PostVehicleBulkMileageInput {
@Field({ description: 'Example: "ISLAND.IS"' })
originCode!: string

@Field(() => [PostVehicleBulkMileageSingleInput])
mileageData!: Array<PostVehicleBulkMileageSingleInput>
}

@InputType()
export class PostVehicleBulkMileageSingleInput {
@Field()
@IsString()
vehicleId!: string

@Field()
@IsInt()
mileageNumber!: number
}
10 changes: 10 additions & 0 deletions libs/api/domains/vehicles/src/lib/dto/vehiclesListInputV3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Field, InputType } from '@nestjs/graphql'

@InputType()
export class VehiclesListInputV3 {
@Field()
pageSize!: number

@Field()
page!: number
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Field, ObjectType } from '@nestjs/graphql'
import { VehicleMileageDetail } from './getVehicleMileage.model'

@ObjectType()
export class NextInspection {
Expand All @@ -11,6 +12,7 @@ export class NextInspection {
})
nextinspectiondateIfPassedInspectionToday?: Date
}

@ObjectType()
export class VehiclesVehicle {
@Field({ nullable: true })
Expand Down Expand Up @@ -243,6 +245,12 @@ export class VehicleListed {

@Field({ nullable: true })
nextMainInspection?: Date

@Field(() => VehicleMileageDetail, { nullable: true })
lastMileageRegistration?: VehicleMileageDetail

@Field(() => [VehicleMileageDetail], { nullable: true })
mileageRegistrationHistory?: Array<VehicleMileageDetail>
}

@ObjectType()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Field, ObjectType, ID } from '@nestjs/graphql'

@ObjectType()
export class VehiclesBulkMileageReadingResponse {
@Field(() => ID, {
description:
'The GUID of the mileage registration post request. Used to fetch job status',
})
requestId!: string

@Field({ nullable: true })
errorMessage?: string
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Field, ObjectType, ID, GraphQLISODateTime } from '@nestjs/graphql'

@ObjectType()
export class VehiclesBulkMileageRegistrationJob {
@Field(() => ID)
guid!: string

@Field({ nullable: true })
reportingPersonNationalId?: string

@Field({ nullable: true })
reportingPersonName?: string

@Field({ nullable: true })
originCode?: string

@Field({ nullable: true })
originName?: string

@Field(() => GraphQLISODateTime, {
nullable: true,
description: 'When was the bulk request requested?',
})
dateRequested?: Date

@Field(() => GraphQLISODateTime, {
nullable: true,
description: 'When did the bulk request start executing?',
})
dateStarted?: Date

@Field(() => GraphQLISODateTime, {
nullable: true,
description: 'When did the bulk request execution finish',
})
dateFinished?: Date
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Field, ObjectType } from '@nestjs/graphql'
import { VehiclesBulkMileageRegistrationJob } from './bulkMileageRegistrationJob.model'

@ObjectType()
export class VehiclesBulkMileageRegistrationJobHistory {
@Field(() => [VehiclesBulkMileageRegistrationJob])
history!: Array<VehiclesBulkMileageRegistrationJob>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Field, ObjectType, ID, Int } from '@nestjs/graphql'
import { VehiclesBulkMileageRegistrationRequestError } from './bulkMileageRegistrationRequestError.model'

@ObjectType()
export class VehiclesBulkMileageRegistrationRequestDetail {
@Field(() => ID)
guid!: string

@Field()
vehicleId!: string

@Field(() => Int, { nullable: true })
mileage?: number

@Field({ nullable: true })
returnCode?: string

@Field(() => [VehiclesBulkMileageRegistrationRequestError], {
nullable: true,
})
errors?: Array<VehiclesBulkMileageRegistrationRequestError>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Field, ObjectType } from '@nestjs/graphql'

@ObjectType()
export class VehiclesBulkMileageRegistrationRequestError {
@Field({ nullable: true })
code?: string

@Field({ nullable: true })
message?: string
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Field, ObjectType } from '@nestjs/graphql'
import { VehiclesBulkMileageRegistrationRequestDetail } from './bulkMileageRegistrationRequestDetail.model'

@ObjectType()
export class VehiclesBulkMileageRegistrationRequestOverview {
@Field(() => [VehiclesBulkMileageRegistrationRequestDetail])
requests!: Array<VehiclesBulkMileageRegistrationRequestDetail>
}
Loading
Loading