diff --git a/app/src/controllers/submission.ts b/app/src/controllers/submission.ts index 8c5f1ad2..b19bc999 100644 --- a/app/src/controllers/submission.ts +++ b/app/src/controllers/submission.ts @@ -96,8 +96,8 @@ const controller = { financiallySupported: Object.values(financiallySupportedValues).includes(true), ...financiallySupportedValues, intakeStatus: toTitleCase(data.form.status), - latitude: parseInt(data.latitude), - longitude: parseInt(data.longitude), + latitude: data.latitude, + longitude: data.longitude, naturalDisaster: data.naturalDisasterInd, projectName: data.projectName, queuePriority: parseInt(data.queuePriority), diff --git a/app/src/db/migrations/20231212000000_init.ts b/app/src/db/migrations/20231212000000_init.ts index 2b55e704..03c1e764 100644 --- a/app/src/db/migrations/20231212000000_init.ts +++ b/app/src/db/migrations/20231212000000_init.ts @@ -89,8 +89,8 @@ export async function up(knex: Knex): Promise { table.text('project_name'); table.text('single_family_units'); table.text('street_address'); - table.integer('latitude'); - table.integer('longitude'); + table.decimal('latitude', 8, 6); + table.decimal('longitude', 9, 6); table.integer('queue_priority'); table.text('related_permits'); table.text('ast_notes'); diff --git a/app/src/db/models/submission.ts b/app/src/db/models/submission.ts index b5a8d481..61ac8772 100644 --- a/app/src/db/models/submission.ts +++ b/app/src/db/models/submission.ts @@ -1,4 +1,5 @@ import { Prisma } from '@prisma/client'; +import { Decimal } from '@prisma/client/runtime/library'; import type { Stamps } from '../stamps'; import type { Submission } from '../../types'; @@ -26,8 +27,8 @@ export default { company_name_registered: input.companyNameRegistered, single_family_units: input.singleFamilyUnits, street_address: input.streetAddress, - latitude: input.latitude, - longitude: input.longitude, + latitude: input.latitude ? new Decimal(input.latitude) : null, + longitude: input.longitude ? new Decimal(input.longitude) : null, queue_priority: input.queuePriority, related_permits: input.relatedPermits, ast_notes: input.astNotes, @@ -73,8 +74,8 @@ export default { companyNameRegistered: input.company_name_registered, singleFamilyUnits: input.single_family_units, streetAddress: input.street_address, - latitude: input.latitude, - longitude: input.longitude, + latitude: input.latitude ? input.latitude.toNumber() : null, + longitude: input.longitude ? input.longitude.toNumber() : null, queuePriority: input.queue_priority, relatedPermits: input.related_permits, astNotes: input.ast_notes, diff --git a/app/src/db/prisma/schema.prisma b/app/src/db/prisma/schema.prisma index d9ac93bb..3782c159 100644 --- a/app/src/db/prisma/schema.prisma +++ b/app/src/db/prisma/schema.prisma @@ -138,8 +138,8 @@ model submission { project_name String? single_family_units String? street_address String? - latitude Int? - longitude Int? + latitude Decimal? @db.Decimal(8, 6) + longitude Decimal? @db.Decimal(9, 6) queue_priority Int? related_permits String? ast_notes String? diff --git a/app/src/services/submission.ts b/app/src/services/submission.ts index 7b7d7164..b5b0f866 100644 --- a/app/src/services/submission.ts +++ b/app/src/services/submission.ts @@ -62,8 +62,8 @@ const service = { financially_supported_non_profit: x.financiallySupportedNonProfit, financially_supported_housing_coop: x.financiallySupportedHousingCoop, intake_status: x.intakeStatus, - latitude: x.latitude, - longitude: x.longitude, + latitude: parseFloat(x.latitude as unknown as string), + longitude: parseFloat(x.longitude as unknown as string), natural_disaster: x.naturalDisaster, project_name: x.projectName, queue_priority: x.queuePriority, diff --git a/app/src/types/ChefsSubmissionExport.ts b/app/src/types/ChefsSubmissionExport.ts index eb7ed36a..3ae4cd68 100644 --- a/app/src/types/ChefsSubmissionExport.ts +++ b/app/src/types/ChefsSubmissionExport.ts @@ -26,8 +26,8 @@ export type ChefsSubmissionExport = { isIndigenousHousingProviderSupported: boolean; isNonProfitSupported: boolean; isHousingCooperativeSupported: boolean; - latitude: string; - longitude: string; + latitude: number; + longitude: number; naturalDisasterInd: boolean; projectName: string; companyNameRegistered: string; diff --git a/frontend/src/components/form/InputNumber.vue b/frontend/src/components/form/InputNumber.vue index 027b2bd5..60d17af9 100644 --- a/frontend/src/components/form/InputNumber.vue +++ b/frontend/src/components/form/InputNumber.vue @@ -46,6 +46,8 @@ const fieldActive: Ref = ref(false); class="w-full" :class="{ 'p-invalid': errorMessage }" :disabled="disabled" + :min-fraction-digits="0" + :max-fraction-digits="6" @focus="fieldActive = true" @blur="fieldActive = false" />