Skip to content

Commit 61487af

Browse files
committed
refactor(common): merge common types & interfaces
1 parent 4cacf4a commit 61487af

File tree

54 files changed

+86
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+86
-163
lines changed

packages/backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@domifa/backend",
33
"private": true,
4-
"version": "2.140.5",
4+
"version": "2.141.0",
55
"description": "",
66
"author": "",
77
"license": "MIT",

packages/backend/src/_common/model/_core/ApiMessage.type.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
//@index('./*', f => `export * from '${f.path}'`)
2-
export * from "./ApiMessage.type";
32
export * from "./AppEntity.type";

packages/backend/src/_common/model/_portail-usager/PortailUsagerPublic.type.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { Telephone } from "./../telephone/Telephone.type";
22
import {
33
UsagerAyantDroit,
44
UsagerDecision,
5-
UsagerLastInteractions,
65
UsagerOptions,
76
UsagerTypeDom,
87
} from "..";
98
import { AppEntity } from "../_core";
10-
import { UsagerRdv, UsagerSexe } from "@domifa/common";
9+
import { UsagerRdv, UsagerSexe, UsagerLastInteraction } from "@domifa/common";
1110

1211
export type PortailUsagerPublic = AppEntity & {
1312
customRef: string; // valeur par défaut: 'ref'
@@ -45,7 +44,7 @@ export type PortailUsagerPublic = AppEntity & {
4544
historique: UsagerDecision[];
4645

4746
// INTERACTIONS
48-
lastInteraction: UsagerLastInteractions;
47+
lastInteraction: UsagerLastInteraction;
4948

5049
options: UsagerOptions;
5150
};

packages/backend/src/_common/model/usager/Usager.type.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ import { AppEntity } from "../_core/AppEntity.type";
22
import { UsagerAyantDroit } from "./UsagerAyantDroit.type";
33
import { UsagerDecision } from "./UsagerDecision.type";
44
import { UsagerImport } from "./UsagerImport.type";
5-
import { UsagerLastInteractions } from "./UsagerLastInteractions.type";
65
import { UsagerNote } from "./UsagerNote.type";
76
import { UsagerOptions } from "./options/UsagerOptions.type";
87

98
import { UsagerTypeDom } from "./UsagerTypeDom.type";
109
import { Telephone } from "../telephone/Telephone.type";
11-
import { UsagerEntretien, UsagerRdv, UsagerSexe } from "@domifa/common";
10+
import {
11+
UsagerLastInteraction,
12+
UsagerEntretien,
13+
UsagerRdv,
14+
UsagerSexe,
15+
} from "@domifa/common";
1216

1317
export type Usager = AppEntity & {
1418
ref: number; // unique par structure
@@ -52,7 +56,7 @@ export type Usager = AppEntity & {
5256
numeroDistribution: string | null;
5357

5458
// INTERACTIONS
55-
lastInteraction: UsagerLastInteractions;
59+
lastInteraction: UsagerLastInteraction;
5660
options: UsagerOptions;
5761

5862
migrated?: boolean;

packages/backend/src/_common/model/usager/UsagerLastInteractions.type.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/backend/src/_common/model/usager/UsagerNote.type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UserStructureResume } from "../user-structure/UserStructureResume.type";
1+
import { UserStructureResume } from "@domifa/common";
22

33
export type UsagerNote = {
44
id: number;

packages/backend/src/_common/model/usager/history/UsagerHistoryImport.type.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { UserStructureResume } from "../../user-structure/UserStructureResume.type";
2-
1+
import { UserStructureResume } from "@domifa/common";
32
export type UsagerHistoryImport = {
43
createdAt: Date;
54
createdBy: UserStructureResume;

packages/backend/src/_common/model/usager/history/UsagerHistoryState.type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UserStructureResume } from "../../user-structure/UserStructureResume.type";
1+
import { UserStructureResume } from "@domifa/common";
22
import { Usager } from "../Usager.type";
33
import { UsagerHistoryStateCreationEvent } from "./UsagerHistoryStateCreationEvent.type";
44

packages/backend/src/_common/model/usager/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export * from "./UsagerAyantDroit.type";
77
export * from "./UsagerDecision.type";
88
export * from "./UsagerDoc.type";
99
export * from "./UsagerImport.type";
10-
export * from "./UsagerLastInteractions.type";
1110
export * from "./UsagerLight.type";
1211
export * from "./UsagerNote.type";
1312
export * from "./UsagerTypeDom.type";

packages/backend/src/_common/model/user-structure/UserStructure.type.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { StructureCommon } from "../structure/StructureCommon.type";
22
import { AppEntity } from "../_core/AppEntity.type";
3-
import { UserStructureMails } from "./UserStructureMails.type";
4-
import { UserStructureRole } from "@domifa/common";
3+
import { UserStructureRole, UserStructureMails } from "@domifa/common";
54

65
export type UserStructure = AppEntity & {
76
id: number;

packages/backend/src/_common/model/user-structure/UserStructureMails.type.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/backend/src/_common/model/user-structure/UserStructureResume.type.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/backend/src/_common/model/user-structure/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// @index('./*', f => `export * from '${f.path}'`)
2-
export * from "./_constants/USER_STRUCTURE_ROLE_ALL.const";
2+
export * from "./_constants";
33
export * from "./UserStructure.type";
44
export * from "./UserStructureAuthenticated.type";
55
export * from "./UserStructureCreatedBy.type";
6-
export * from "./UserStructureMails.type";
76
export * from "./UserStructureProfile.type";
87
export * from "./UserStructurePublic.type";
9-
export * from "./UserStructureResume.type";
108
export * from "./UserStructureSecurity.type";
119
export * from "./UserStructureSecurityEvent.type";
1210
export * from "./UserStructureSecurityEventType.type";

packages/backend/src/_common/model/user-usager/UserUsager.type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UserStructureResume } from "../user-structure/UserStructureResume.type";
1+
import { UserStructureResume } from "@domifa/common";
22
import { AppEntity } from "../_core/AppEntity.type";
33

44
export type UserUsager = AppEntity & {

packages/backend/src/database/entities/usager/UsagerNotesTable.typeorm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm";
1111
import { StructureTable } from "../structure";
1212
import { UsagerTable } from "./UsagerTable.typeorm";
13-
import { UsagerNote, UserStructureResume } from "../../../_common/model";
14-
13+
import { UsagerNote } from "../../../_common/model";
14+
import { UserStructureResume } from "@domifa/common";
1515
// https://typeorm.io/#/entities/column-types-for-postgres
1616
@Entity({ name: "usager_notes" })
1717
export class UsagerNotesTable

packages/backend/src/database/entities/usager/UsagerTable.typeorm.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
} from "typeorm";
1212
import {
1313
Usager,
14-
UsagerLastInteractions,
1514
UsagerOptions,
1615
UsagerTypeDom,
1716
Telephone,
@@ -24,7 +23,12 @@ import { StructureTable } from "../structure/StructureTable.typeorm";
2423
import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm";
2524
import { UsagerImport } from "./../../../_common/model/usager/UsagerImport.type";
2625
import { UsagerNotesTable } from "./UsagerNotesTable.typeorm";
27-
import { UsagerEntretien, UsagerRdv, UsagerSexe } from "@domifa/common";
26+
import {
27+
UsagerEntretien,
28+
UsagerRdv,
29+
UsagerSexe,
30+
UsagerLastInteraction,
31+
} from "@domifa/common";
2832

2933
// https://typeorm.io/#/entities/column-types-for-postgres
3034
@Entity({ name: "usager" })
@@ -108,7 +112,7 @@ export class UsagerTable
108112
default:
109113
'{"dateInteraction":"NOW()", "enAttente":"false", "courrierIn":"0", "recommandeIn":"0", "colisIn":"0"}',
110114
})
111-
public lastInteraction!: UsagerLastInteractions;
115+
public lastInteraction!: UsagerLastInteraction;
112116

113117
@Column({ type: "integer", default: 0 })
114118
public etapeDemande!: number;

packages/backend/src/database/entities/user-structure/UserStructureTable.typeorm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
} from "typeorm";
1010
import { titleCase } from "typeorm/util/StringUtils";
1111
import { StructureTable } from "..";
12-
import { UserStructure, UserStructureMails } from "../../../_common/model";
12+
import { UserStructure } from "../../../_common/model";
1313
import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm";
14-
import { UserStructureRole } from "@domifa/common";
14+
import { UserStructureRole, UserStructureMails } from "@domifa/common";
1515

1616
// https://typeorm.io/#/entities/column-types-for-postgres
1717
@Entity({ name: "user_structure" })

packages/backend/src/database/entities/user-usager/UserUsagerTable.typeorm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import {
88
OneToOne,
99
} from "typeorm";
1010
import { StructureTable, UsagerTable } from "..";
11-
12-
import { UserStructureResume, UserUsager } from "../../../_common/model";
11+
import { UserStructureResume } from "@domifa/common";
12+
import { UserUsager } from "../../../_common/model";
1313
import { AppTypeormTable } from "../_core/AppTypeormTable.typeorm";
1414

1515
// https://typeorm.io/#/entities/column-types-for-postgres

packages/backend/src/usagers/controllers/usager-notes.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import {
2222
Usager,
2323
UsagerNote,
2424
UserStructureAuthenticated,
25-
UserStructureResume,
2625
} from "../../_common/model";
26+
import { UserStructureResume } from "@domifa/common";
2727
import { CreateNoteDto } from "../dto/create-note.dto";
2828
import {
2929
AppLogTable,

packages/backend/src/usagers/services/usagerHistoryStateManager.service.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import { UsagerHistoryTable } from "../../database/entities/usager/UsagerHistoryTable.typeorm";
22
import { usagerHistoryRepository } from "../../database/services/usager/usagerHistoryRepository.service";
3-
4-
import {
5-
Usager,
6-
UsagerHistory,
7-
UsagerHistoryState,
8-
UserStructureResume,
9-
} from "../../_common/model";
3+
import { UserStructureResume } from "@domifa/common";
4+
import { Usager, UsagerHistory, UsagerHistoryState } from "../../_common/model";
105
import { UsagerHistoryStateCreationEvent } from "../../_common/model/usager/history/UsagerHistoryStateCreationEvent.type";
116
import { v4 as uuidv4 } from "uuid";
127
import { endOfDay, startOfDay, subDays } from "date-fns";

packages/common/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @index('./*', f => `export * from '${f.path}'`)
22
export * from "./_core";
3-
export * from "./usager";
43
export * from "./structure";
5-
export * from "./user";
4+
export * from "./usager";
5+
export * from "./user-structure";

packages/common/src/usager/interfaces/UsagerLastInteractions.interface.ts renamed to packages/common/src/usager/interfaces/UsagerLastInteraction.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface UsagerLastInteractions {
1+
export interface UsagerLastInteraction {
22
dateInteraction: Date;
33
enAttente: boolean;
44
courrierIn: number;

packages/common/src/usager/interfaces/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ export * from "./UsagerAyantDroit.interface";
33
export * from "./UsagerDecision.interface";
44
export * from "./UsagerDoc.interface";
55
export * from "./UsagerEntretien.interface";
6-
export * from "./UsagerLastInteractions.interface";
6+
export * from "./UsagerLastInteraction.interface";
77
export * from "./UsagerRdv.interface";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// @index('./*', f => `export * from '${f.path}'`)
2+
export * from "./interfaces";
23
export * from "./types";
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface UserStructureMails {
2+
guide: boolean;
3+
import: boolean;
4+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export type UserStructureResume = {
1+
export interface UserStructureResume {
22
userId: number; // UserStructure.id
33
userName: string; // UserStructure.nom / prenom
4-
};
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// @index('./*', f => `export * from '${f.path}'`)
2+
export * from "./UserStructureMails.interface";
3+
export * from "./UserStructureResume.interface";

packages/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@domifa/frontend",
3-
"version": "2.140.5",
3+
"version": "2.141.0",
44
"main": "index.js",
55
"author": "Incubateur des Ministères Sociaux <[email protected]> (https://incubateur.social.gouv.fr)",
66
"license": "Apache-2.0",

packages/frontend/src/_common/mocks/USER_STRUCTURE.mock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CountryISO } from "ngx-intl-tel-input";
2-
import { UserStructure, UserStructureRole } from "../model";
3-
import { StructureType } from "@domifa/common";
2+
import { UserStructure } from "../model";
3+
import { StructureType, UserStructureRole } from "@domifa/common";
44

55
export const USER_STRUCTURE_MOCK: UserStructure = {
66
password: "xxx",

packages/frontend/src/_common/model/_general/ApiMessage.type.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
//@index('./*', f => `export * from '${f.path}'`)
2-
export * from "./ApiMessage.type";
32
export * from "./DEFAULT_MODAL_OPTIONS.const";
43
export * from "./FormEmailTakenValidator.type";

packages/frontend/src/_common/model/usager/Usager.type.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { UsagerEntretien } from "./entretien";
99
import { UsagerDecision } from "./decision/types/UsagerDecision.type";
1010

1111
import { UsagerImport } from "./UsagerImport.type";
12-
import { UsagerLastInteractions } from "./UsagerLastInteractions.type";
12+
1313
import { UsagerNote } from "./UsagerNote.type";
1414
import { UsagerOptions } from "./options/UsagerOptions.type";
1515

@@ -18,6 +18,7 @@ import {
1818
UsagerRdv,
1919
UsagerSexe,
2020
UsagerTypeDom,
21+
UsagerLastInteraction,
2122
} from "@domifa/common";
2223

2324
export type Usager = AppEntity & {
@@ -59,7 +60,7 @@ export type Usager = AppEntity & {
5960
historique: UsagerDecision[];
6061

6162
// INTERACTIONS
62-
lastInteraction: UsagerLastInteractions;
63+
lastInteraction: UsagerLastInteraction;
6364

6465
options: UsagerOptions;
6566
numeroDistribution: string | null;

packages/frontend/src/_common/model/usager/UsagerLastInteractions.type.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/frontend/src/_common/model/usager/UsagerNote.type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UserStructureResume } from "../user-structure/UserStructureResume.type";
1+
import { UserStructureResume } from "@domifa/common";
22

33
export type UsagerNote = {
44
id: number;

packages/frontend/src/_common/model/usager/history/UsagerHistory.type.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/frontend/src/_common/model/usager/history/UsagerHistoryImport.type.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/frontend/src/_common/model/usager/history/UsagerHistoryState.type.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/frontend/src/_common/model/usager/history/UsagerHistoryStateCreationEvent.type.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/frontend/src/_common/model/usager/history/index.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)