diff --git a/src/domain-services/flows/model.ts b/src/domain-services/flows/model.ts index 03400739..b253fb62 100644 --- a/src/domain-services/flows/model.ts +++ b/src/domain-services/flows/model.ts @@ -1,7 +1,6 @@ import { type Database } from '@unocha/hpc-api-core/src/db'; import { type FlowId } from '@unocha/hpc-api-core/src/db/models/flow'; import { type InstanceDataOfModel } from '@unocha/hpc-api-core/src/db/util/raw-model'; -import Knex from 'knex'; import { type SortOrder } from '../../utils/graphql/pagination'; export type FlowEntity = InstanceDataOfModel; diff --git a/src/domain-services/location/graphql/types.ts b/src/domain-services/location/graphql/types.ts index 27f9ecec..7d42abec 100644 --- a/src/domain-services/location/graphql/types.ts +++ b/src/domain-services/location/graphql/types.ts @@ -1,6 +1,6 @@ import { Brand } from '@unocha/hpc-api-core/src/util/types'; import { MaxLength } from 'class-validator'; -import { Field, ID, Int, ObjectType, registerEnumType } from 'type-graphql'; +import { Field, ID, ObjectType, registerEnumType } from 'type-graphql'; import { BaseType } from '../../../utils/graphql/base-types'; export enum LocationStatus { @@ -25,7 +25,7 @@ export default class Location extends BaseType { @MaxLength(255) name?: string; - @Field(() => Int) + @Field(() => Number) adminLevel: number; // Accidentally optional @Field({ nullable: true }) @@ -34,7 +34,7 @@ export default class Location extends BaseType { @Field({ nullable: true }) longitude?: number; - @Field(() => Int, { nullable: true }) + @Field(() => Number, { nullable: true }) parentId?: number; @Field({ nullable: true }) @@ -47,7 +47,7 @@ export default class Location extends BaseType { @Field(() => LocationStatus) status?: LocationStatus; // Accidentally optional - @Field(() => Int, { nullable: true }) + @Field(() => Number, { nullable: true }) validOn?: number; @Field({ defaultValue: true }) @@ -56,12 +56,42 @@ export default class Location extends BaseType { @ObjectType() export class BaseLocation extends BaseType { - @Field({ nullable: false }) + @Field({ nullable: true }) id: number; - @Field(() => String, { nullable: false }) + @Field(() => String, { nullable: true }) name: string | null; - @Field({ nullable: false }) + @Field({ nullable: true }) direction: string; + + @Field({ nullable: true }) + externalId?: string; + + @Field(() => Number) + adminLevel: number | null; // Accidentally optional + + @Field(() => Number, { nullable: true }) + latitude: number | null; + + @Field(() => Number, { nullable: true }) + longitude: number | null; + + @Field(() => Number, { nullable: true }) + parentId: number | null; + + @Field(() => String, { nullable: true }) + iso3: string | null; + + @Field(() => String, { nullable: true }) + pcode: string | null; + + @Field(() => String) + status: string | null; // Accidentally optional + + @Field(() => Number, { nullable: true }) + validOn: string | number | null; + + @Field({ defaultValue: true }) + itosSync: boolean; // Accidentally optional } diff --git a/src/domain-services/location/location-service.ts b/src/domain-services/location/location-service.ts index c571ac9c..0261ddd1 100644 --- a/src/domain-services/location/location-service.ts +++ b/src/domain-services/location/location-service.ts @@ -78,13 +78,22 @@ export class LocationService { private mapLocationsToFlowLocations( location: InstanceDataOfModel, locationFO: InstanceDataOfModel - ) { + ): BaseLocation { return { id: location.id, name: location.name, direction: locationFO.refDirection, createdAt: location.createdAt.toISOString(), updatedAt: location.updatedAt.toISOString(), + adminLevel: location.adminLevel, + latitude: location.latitude, + longitude: location.longitude, + parentId: location.parentId, + iso3: location.iso3, + status: location.status, + validOn: location.validOn, + itosSync: location.itosSync, + pcode: location.pcode, }; } } diff --git a/src/domain-services/organizations/graphql/types.ts b/src/domain-services/organizations/graphql/types.ts index c4ebdb23..4e592032 100644 --- a/src/domain-services/organizations/graphql/types.ts +++ b/src/domain-services/organizations/graphql/types.ts @@ -7,11 +7,38 @@ export class Organization extends BaseType { id: number; @Field({ nullable: true }) - direction: string; + name: string; @Field({ nullable: true }) - name: string; + direction: string; @Field({ nullable: true }) abbreviation: string; + + @Field({ nullable: true }) + url: string; + + @Field({ nullable: true }) + parentID: number; + + @Field({ nullable: true }) + nativeName: string; + + @Field({ nullable: true }) + comments: string; + + @Field({ nullable: true }) + collectiveInd: string; + + @Field({ nullable: true }) + active: boolean; + + @Field({ nullable: true }) + newOrganisationId: number; + + @Field({ nullable: true }) + verified: boolean; + + @Field({ nullable: true }) + notes: string; } diff --git a/src/domain-services/organizations/organization-service.ts b/src/domain-services/organizations/organization-service.ts index f235a918..17bc6cc5 100644 --- a/src/domain-services/organizations/organization-service.ts +++ b/src/domain-services/organizations/organization-service.ts @@ -59,6 +59,15 @@ export class OrganizationService { createdAt: organization.createdAt.toISOString(), updatedAt: organization.updatedAt.toISOString(), abbreviation: organization.abbreviation, + url: organization.url, + parentID: organization.parentID, + nativeName: organization.nativeName, + comments: organization.comments, + collectiveInd: organization.collectiveInd, + active: organization.active, + newOrganisationId: organization.newOrganisationId, + verified: organization.verified, + notes: organization.notes, }; } } diff --git a/src/domain-services/plans/graphql/types.ts b/src/domain-services/plans/graphql/types.ts index 9a6fe4fc..c12b7760 100644 --- a/src/domain-services/plans/graphql/types.ts +++ b/src/domain-services/plans/graphql/types.ts @@ -99,12 +99,48 @@ export default class Plan { @ObjectType() export class BasePlan extends BaseType { - @Field({ nullable: false }) + @Field({ nullable: true }) id: number; - @Field({ nullable: false }) + @Field({ nullable: true }) name: string; - @Field({ nullable: false }) + @Field({ nullable: true }) direction: string; + + @Field({ nullable: true }) + startDate: string; + + @Field({ nullable: true }) + endDate: string; + + @Field(() => String, { nullable: true }) + comments: string | null; + + @Field({ nullable: true }) + isForHPCProjects: boolean; + + @Field(() => String, { nullable: true }) + code: string | null; + + @Field(() => String, { nullable: true }) + customLocationCode: string | null; + + @Field(() => Number, { nullable: true }) + currentReportingPeriodId: number | null; + + @Field({ nullable: true }) + currentVersion: boolean; + + @Field({ nullable: true }) + latestVersion: boolean; + + @Field({ nullable: true }) + latestTaggedVersion: boolean; + + @Field(() => Number, { nullable: true }) + lastPublishedReportingPeriodId: number | null; + + @Field(() => String, { nullable: true }) + clusterSelectionType: string | null; } diff --git a/src/domain-services/plans/plan-service.ts b/src/domain-services/plans/plan-service.ts index 2920b8c9..a5476825 100644 --- a/src/domain-services/plans/plan-service.ts +++ b/src/domain-services/plans/plan-service.ts @@ -112,6 +112,19 @@ export class PlanService { createdAt: plan.createdAt.toISOString(), updatedAt: plan.updatedAt.toISOString(), direction: direction ?? '', + startDate: planVersion.startDate.toISOString(), + endDate: planVersion.endDate.toISOString(), + comments: planVersion.comments, + isForHPCProjects: planVersion.isForHPCProjects, + code: planVersion.code, + customLocationCode: planVersion.customLocationCode, + currentReportingPeriodId: planVersion.currentReportingPeriodId, + currentVersion: planVersion.currentVersion, + latestVersion: planVersion.latestVersion, + latestTaggedVersion: planVersion.latestTaggedVersion, + lastPublishedReportingPeriodId: + planVersion.lastPublishedReportingPeriodId, + clusterSelectionType: planVersion.clusterSelectionType, }; } }