Skip to content

Commit

Permalink
feat(assets): Bulk mileage registration (#15774)
Browse files Browse the repository at this point in the history
* Vehicle bulk mileage frontend

* feat: omg it works

* chore: remove logs

* chore: nx format:write update dirty files

* fix: more messsages

* feat: bad csv parser

* fix: failure calblack

* feat: refactor logic

* chore: nx format:write update dirty files

* feat: better org

* chore: update config

* feat: update client

* feat: update with mutation

* feat: organize domain and add methods

* feat: update domain

* fix: better csv parsing

* chore: label

* chore: nx format:write update dirty files

* feat: some ui

* chore: nx format:write update dirty files

* feat/clearer ui

* chore: empty screen

* fix: remove buttons

* fix: expand callbacks

* fix: linting

* fix: expand lower

* chore: remove console

* chore: localize messages

* chore: imports

* fix: add logos

* fix: parsing

* fix: reveiw comments

* chore: nx format:write update dirty files

* fix: more review fixes

* chore: review comment v3

* chore: fix func name

* chore: review2
gp

* chore: add error message

* fix:nullechck

* fix:review

---------

Co-authored-by: Þórður Hafliðason <tolleinn@gmail.com>
Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored and thoreyjona committed Oct 2, 2024
1 parent 5e1f11c commit a0aecdf
Show file tree
Hide file tree
Showing 76 changed files with 3,209 additions and 230 deletions.
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

0 comments on commit a0aecdf

Please sign in to comment.