Skip to content

Commit

Permalink
Revert "feat: delete position inconnue (#502)" (#503)
Browse files Browse the repository at this point in the history
This reverts commit fd950fa.
  • Loading branch information
fufeck authored Jan 15, 2025
1 parent fd950fa commit 9b74678
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 87 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
clock: yarn start:cron
postdeploy: bash scripts/postdeploy.sh
postdeploy: yarn typeorm:migration:run
2 changes: 1 addition & 1 deletion apps/api/src/lib/utils/csv.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function extractCodeCommune({
function extractPosition(row: any) {
return {
source: row.parsedValues.source || null,
type: row.parsedValues.position || PositionTypeEnum.ENTREE,
type: row.parsedValues.position || PositionTypeEnum.INCONNUE,
point: {
type: 'Point',
coordinates: [row.parsedValues.long, row.parsedValues.lat],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import {
IsNotEmpty,
IsMongoId,
ValidateIf,
Validate,
} from 'class-validator';

import { PositionTypeEnum } from '@/shared/entities/position.entity';
import { ValidatorBal } from '@/shared/validators/validator_bal.validator';

export class UpdateBatchNumeroChangeDTO {
@IsOptional()
Expand All @@ -33,7 +31,6 @@ export class UpdateBatchNumeroChangeDTO {
@IsOptional()
@IsNotEmpty()
@IsEnum(PositionTypeEnum)
@Validate(ValidatorBal, ['position'])
@ApiProperty({ required: false, nullable: false })
positionType?: PositionTypeEnum;

Expand Down
6 changes: 3 additions & 3 deletions apps/api/test/base_locale.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('BASE LOCAL MODULE', () => {
};
return {
id,
type: PositionTypeEnum.ENTREE,
type: PositionTypeEnum.INCONNUE,
source: 'ban',
point,
} as Position;
Expand Down Expand Up @@ -579,8 +579,8 @@ describe('BASE LOCAL MODULE', () => {
'text/csv; charset=utf-8',
);
const csvFile = `cle_interop;id_ban_commune;id_ban_toponyme;id_ban_adresse;voie_nom;lieudit_complement_nom;numero;suffixe;certification_commune;commune_insee;commune_nom;position;long;lat;x;y;cad_parcelles;source;date_der_maj
91534_xxxx_00001_bis;${communeUuid};${voieUuid1};${numeroUuid1};rue de la paix;allée;1;bis;1;91534;Saclay;entrée;8;42;1114835.92;6113076.85;;ban;2000-01-02
91534_xxxx_00001_ter;${communeUuid};${voieUuid2};${numeroUuid2};rue de paris;allée;1;ter;0;91534;Saclay;entrée;8;42;1114835.92;6113076.85;;ban;2000-01-02
91534_xxxx_00001_bis;${communeUuid};${voieUuid1};${numeroUuid1};rue de la paix;allée;1;bis;1;91534;Saclay;inconnue;8;42;1114835.92;6113076.85;;ban;2000-01-02
91534_xxxx_00001_ter;${communeUuid};${voieUuid2};${numeroUuid2};rue de paris;allée;1;ter;0;91534;Saclay;inconnue;8;42;1114835.92;6113076.85;;ban;2000-01-02
91534_xxxx_99999;${communeUuid};${toponymeUuid1};;allée;;99999;;;91534;Saclay;;;;;;;commune;2000-01-02`;
expect(response.text.replace(/\s/g, '')).toEqual(
csvFile.replace(/\s/g, ''),
Expand Down
2 changes: 1 addition & 1 deletion apps/api/test/numero.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ describe('NUMERO', () => {
positions: [
{
id: new ObjectId().toHexString(),
type: PositionTypeEnum.ENTREE,
type: PositionTypeEnum.INCONNUE,
source: 'ban',
point: {
type: 'Point',
Expand Down
8 changes: 4 additions & 4 deletions apps/api/test/publication.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe('PUBLICATION MODULE', () => {
};
return {
id,
type: PositionTypeEnum.ENTREE,
type: PositionTypeEnum.INCONNUE,
source: 'ban',
point,
} as Position;
Expand Down Expand Up @@ -225,7 +225,7 @@ describe('PUBLICATION MODULE', () => {
axiosMock.onPost(`/revisions/${revisionId}/compute`).reply(200, revision);

const csvFile = `cle_interop;id_ban_commune;id_ban_toponyme;id_ban_adresse;voie_nom;lieudit_complement_nom;numero;suffixe;certification_commune;commune_insee;commune_nom;position;long;lat;x;y;cad_parcelles;source;date_der_maj
91534_xxxx_00001_bis;${communeUuid};${voieUuid};${numeroUuid};rue de la paix;;1;bis;1;91534;Saclay;entrée;8;42;1114835.92;6113076.85;;ban;2000-01-01`;
91534_xxxx_00001_bis;${communeUuid};${voieUuid};${numeroUuid};rue de la paix;;1;bis;1;91534;Saclay;inconnue;8;42;1114835.92;6113076.85;;ban;2000-01-01`;
axiosMock
.onPut(`/revisions/${revisionId}/files/bal`)
.reply(({ data }) => {
Expand Down Expand Up @@ -346,7 +346,7 @@ describe('PUBLICATION MODULE', () => {
axiosMock.onPost(`/revisions/${revisionId}/compute`).reply(200, revision);

const csvFile = `cle_interop;id_ban_commune;id_ban_toponyme;id_ban_adresse;voie_nom;lieudit_complement_nom;numero;suffixe;certification_commune;commune_insee;commune_nom;position;long;lat;x;y;cad_parcelles;source;date_der_maj
91534_xxxx_00001_bis;${communeUuid};${toponymeUuid};${numeroUuid};rue de la paix;;1;bis;1;91534;Saclay;entrée;8;42;1114835.92;6113076.85;;ban;2000-01-01`;
91534_xxxx_00001_bis;${communeUuid};${toponymeUuid};${numeroUuid};rue de la paix;;1;bis;1;91534;Saclay;inconnue;8;42;1114835.92;6113076.85;;ban;2000-01-01`;
axiosMock
.onPut(`/revisions/${revisionId}/files/bal`)
.reply(({ data }) => {
Expand Down Expand Up @@ -409,7 +409,7 @@ describe('PUBLICATION MODULE', () => {
files: [
{
type: 'bal',
hash: '8e23f1782299e8d5970c1fa800a7074beaac7eeac4c1f0c484e4f6441f680011',
hash: '0c5d808a7e5612c9467607c574cb2317a76fe04d493efbd61b55a31bbd194227',
},
],
};
Expand Down
2 changes: 1 addition & 1 deletion apps/api/test/toponyme.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe('TOPONYME MODULE', () => {
};
return {
id,
type: PositionTypeEnum.ENTREE,
type: PositionTypeEnum.INCONNUE,
source: 'ban',
point,
} as Position;
Expand Down
6 changes: 3 additions & 3 deletions apps/cron/test/task.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ describe('TASK MODULE', () => {
};
return {
id,
type: PositionTypeEnum.ENTREE,
type: PositionTypeEnum.INCONNUE,
source: 'ban',
point,
} as Position;
Expand Down Expand Up @@ -370,7 +370,7 @@ describe('TASK MODULE', () => {
axiosMock.onPost(`/revisions/${revisionId}/compute`).reply(200, revision);

const csvFile = `cle_interop;id_ban_commune;id_ban_toponyme;id_ban_adresse;voie_nom;lieudit_complement_nom;numero;suffixe;certification_commune;commune_insee;commune_nom;position;long;lat;x;y;cad_parcelles;source;date_der_maj
91534_xxxx_00001_bis;52c4de09-6b82-45eb-8ed7-b212607282f7;26734c2d-2a14-4eeb-ac5b-1be055c0a5ae;2da3bb47-1a10-495a-8c29-6b8d0e79f9af;rue de la paix;;1;bis;1;91534;Saclay;entrée;8;42;1114835.92;6113076.85;;ban;2000-01-01`;
91534_xxxx_00001_bis;52c4de09-6b82-45eb-8ed7-b212607282f7;26734c2d-2a14-4eeb-ac5b-1be055c0a5ae;2da3bb47-1a10-495a-8c29-6b8d0e79f9af;rue de la paix;;1;bis;1;91534;Saclay;inconnue;8;42;1114835.92;6113076.85;;ban;2000-01-01`;
axiosMock.onPut(`/revisions/${revisionId}/files/bal`).reply(({ data }) => {
expect(data.replace(/\s/g, '')).toEqual(csvFile.replace(/\s/g, ''));
return [200, null];
Expand Down Expand Up @@ -425,7 +425,7 @@ describe('TASK MODULE', () => {
files: [
{
type: 'bal',
hash: '5a9646ce4fe552b0dc619e166b0ce7968fa34c94e634331b090452a26c888f7d',
hash: 'a62492c9dbd6c74e7cfb2b67b3a9e49be89da7b8fa4dff3c061b0f82805b65c9',
},
],
};
Expand Down
3 changes: 1 addition & 2 deletions libs/shared/src/entities/position.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { Toponyme } from './toponyme.entity';
import { ObjectId } from 'mongodb';
import { Validate } from 'class-validator';
import { PointValidator } from '../validators/coord.validator';
import { ValidatorBal } from '../validators/validator_bal.validator';

export enum PositionTypeEnum {
ENTREE = 'entrée',
Expand All @@ -25,6 +24,7 @@ export enum PositionTypeEnum {
DELIVRANCE_POSTALE = 'délivrance postale',
PARCELLE = 'parcelle',
SEGMENT = 'segment',
INCONNUE = 'inconnue',
}

@Entity({ name: 'positions' })
Expand All @@ -49,7 +49,6 @@ export class Position {
numeroId?: string;

@ApiProperty({ enum: PositionTypeEnum })
@Validate(ValidatorBal, ['position'])
@Column('enum', {
enum: PositionTypeEnum,
default: PositionTypeEnum.ENTREE,
Expand Down
65 changes: 0 additions & 65 deletions migrations/1736244568004-delete_position_inconnue.ts

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/postdeploy.sh

This file was deleted.

0 comments on commit 9b74678

Please sign in to comment.