Skip to content

Commit

Permalink
Move models to shared folder
Browse files Browse the repository at this point in the history
  • Loading branch information
farnoux committed Dec 24, 2024
1 parent 0d0fa6a commit 2d0ce1c
Show file tree
Hide file tree
Showing 30 changed files with 49 additions and 61 deletions.
18 changes: 9 additions & 9 deletions backend/src/indicateurs/definitions/indicateur-filtre.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import { categorieTagTable } from '../../collectivites/shared/models/categorie-t
import { groupementCollectiviteTable } from '../../collectivites/shared/models/groupement-collectivite.table';
import { ficheActionTable } from '../../plans/fiches/shared/models/fiche-action.table';
import { DatabaseService } from '../../utils/database/database.service';
import { indicateurActionTable } from '../models/indicateur-action.table';
import { indicateurCategorieTagTable } from '../models/indicateur-categorie-tag.table';
import { indicateurCollectiviteTable } from '../models/indicateur-collectivite.table';
import { indicateurDefinitionTable } from '../models/indicateur-definition.table';
import { indicateurGroupeTable } from '../models/indicateur-groupe.table';
import { indicateurPiloteTable } from '../models/indicateur-pilote.table';
import { indicateurServiceTagTable } from '../models/indicateur-service-tag.table';
import { indicateurThematiqueTable } from '../models/indicateur-thematique.table';
import { indicateurValeurTable } from '../models/indicateur-valeur.table';
import { indicateurActionTable } from '../shared/models/indicateur-action.table';
import { indicateurCategorieTagTable } from '../shared/models/indicateur-categorie-tag.table';
import { indicateurCollectiviteTable } from '../shared/models/indicateur-collectivite.table';
import { indicateurDefinitionTable } from '../shared/models/indicateur-definition.table';
import { indicateurGroupeTable } from '../shared/models/indicateur-groupe.table';
import { indicateurPiloteTable } from '../shared/models/indicateur-pilote.table';
import { indicateurServiceTagTable } from '../shared/models/indicateur-service-tag.table';
import { indicateurThematiqueTable } from '../shared/models/indicateur-thematique.table';
import { indicateurValeurTable } from '../shared/models/indicateur-valeur.table';
import {
GetFilteredIndicateurRequestQueryOptionType,
GetFilteredIndicateursRequestOptionType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
IndicateurDefinition,
IndicateurDefinitionAvecEnfantsType,
indicateurDefinitionTable,
} from '../models/indicateur-definition.table';
import { indicateurGroupeTable } from '../models/indicateur-groupe.table';
} from '../shared/models/indicateur-definition.table';
import { indicateurGroupeTable } from '../shared/models/indicateur-groupe.table';

@Injectable()
export default class ListDefinitionsService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ApiResponse, ApiTags } from '@nestjs/swagger';
import { Response } from 'express';
import { TokenInfo } from '../../auth/decorators/token-info.decorators';
import type { AuthenticatedUser } from '../../auth/models/auth.models';
import { exportIndicateursRequestSchema } from '../models/export-indicateurs.request';
import { exportIndicateursRequestSchema } from '../shared/models/export-indicateurs.request';
import ExportIndicateursService from './export-indicateurs.service';

class GetExportIndicateursRequestClass extends createZodDto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import {
normalizeWorksheetName,
} from '../../utils/excel/excel.utils';
import ListDefinitionsService from '../definitions/list-definitions.service';
import { ExportIndicateursRequestType } from '../models/export-indicateurs.request';
import { ExportIndicateursRequestType } from '../shared/models/export-indicateurs.request';
import {
IndicateurDefinitionAvecEnfantsType,
IndicateurDefinitionEssential,
} from '../models/indicateur-definition.table';
import { SourceMetadonnee } from '../models/indicateur-source-metadonnee.table';
import { IndicateurValeurAvecMetadonnesDefinition } from '../models/indicateur-valeur.table';
} from '../shared/models/indicateur-definition.table';
import { SourceMetadonnee } from '../shared/models/indicateur-source-metadonnee.table';
import { IndicateurValeurAvecMetadonnesDefinition } from '../shared/models/indicateur-valeur.table';
import CrudValeursService from '../valeurs/crud-valeurs.service';

@Injectable()
Expand Down
8 changes: 4 additions & 4 deletions backend/src/indicateurs/index-domain.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// `index-domain.ts` file must only contain exports that are shareable with client-side apps.
// Exports from this file can be imported with `@/domain/*` alias path.

export * from './models/indicateur-definition.table';
export * from './models/indicateur-source-metadonnee.table';
export * from './models/indicateur-source.table';
export * from './models/indicateur-valeur.table';
export * from './shared/models/indicateur-definition.table';
export * from './shared/models/indicateur-source-metadonnee.table';
export * from './shared/models/indicateur-source.table';
export * from './shared/models/indicateur-valeur.table';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { actionRelationTable } from '@/domain/referentiels';
import { integer, pgTable, primaryKey, varchar } from 'drizzle-orm/pg-core';
import { indicateurDefinitionTable } from './indicateur-definition.table';
import { actionRelationTable } from '../../referentiels/models/action-relation.table';

export const indicateurActionTable = pgTable(
'indicateur_action',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { categorieTagTable } from '@/domain/collectivites';
import { integer, pgTable, primaryKey } from 'drizzle-orm/pg-core';
import { categorieTagTable } from '../../collectivites/shared/models/categorie-tag.table';
import { indicateurDefinitionTable } from './indicateur-definition.table';

export const indicateurCategorieTagTable = pgTable(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { collectiviteTable } from '@/domain/collectivites';
import {
boolean,
integer,
pgTable,
primaryKey,
text,
} from 'drizzle-orm/pg-core';
import { collectiviteTable } from '../../collectivites/shared/models/collectivite.table';
import { indicateurDefinitionTable } from './indicateur-definition.table';

export const indicateurCollectiviteTable = pgTable(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { collectiviteTable } from '@/domain/collectivites';
import { createdAt, createdBy, modifiedAt, modifiedBy } from '@/domain/utils';
import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
import {
boolean,
Expand All @@ -9,13 +11,6 @@ import {
} from 'drizzle-orm/pg-core';
import { createInsertSchema, createSelectSchema } from 'drizzle-zod';
import { z } from 'zod';
import { collectiviteTable } from '../../collectivites/shared/models/collectivite.table';
import {
createdAt,
createdBy,
modifiedAt,
modifiedBy,
} from '../../utils/column.utils';

export const indicateurDefinitionTable = pgTable('indicateur_definition', {
id: serial('id').primaryKey(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { integer, pgTable, serial, uuid } from 'drizzle-orm/pg-core';
import { collectiviteTable } from '../../collectivites/shared/models/collectivite.table';
import { personneTagTable } from '../../collectivites/shared/models/personne-tag.table';
import { indicateurDefinitionTable } from './indicateur-definition.table';
import { collectiviteTable, personneTagTable } from '@/domain/collectivites';

export const indicateurPiloteTable = pgTable('indicateur_pilote', {
id: serial('id').primaryKey(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { serviceTagTable } from '@/domain/collectivites';
import { collectiviteTable, serviceTagTable } from '@/domain/collectivites';
import { integer, pgTable, primaryKey } from 'drizzle-orm/pg-core';
import { collectiviteTable } from '../../collectivites/shared/models/collectivite.table';
import { indicateurDefinitionTable } from './indicateur-definition.table';

export const indicateurServiceTagTable = pgTable(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { thematiqueTable } from '@/domain/shared';
import { integer, pgTable, primaryKey } from 'drizzle-orm/pg-core';
import { thematiqueTable } from '../../shared/models/thematique.table';
import { indicateurDefinitionTable } from './indicateur-definition.table';

export const indicateurThematiqueTable = pgTable(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { collectiviteTable } from '@/domain/collectivites';
import { createdAt, createdBy, modifiedAt, modifiedBy } from '@/domain/utils';
import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
import {
date,
Expand All @@ -9,13 +11,6 @@ import {
} from 'drizzle-orm/pg-core';
import { createInsertSchema, createSelectSchema } from 'drizzle-zod';
import { z } from 'zod';
import { collectiviteTable } from '../../collectivites/shared/models/collectivite.table';
import {
createdAt,
createdBy,
modifiedAt,
modifiedBy,
} from '../../utils/column.utils';
import {
IndicateurDefinition,
indicateurDefinitionSchema,
Expand Down
4 changes: 2 additions & 2 deletions backend/src/indicateurs/sources/indicateur-sources.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {
indicateurSourceMetadonneeTable,
SourceMetadonnee,
SourceMetadonneeInsert,
} from '../models/indicateur-source-metadonnee.table';
} from '../shared/models/indicateur-source-metadonnee.table';
import {
indicateurSourceTable,
SourceInsert,
} from '../models/indicateur-source.table';
} from '../shared/models/indicateur-source.table';

@Injectable()
export default class IndicateurSourcesService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Test } from '@nestjs/testing';
import CollectivitesService from '../../collectivites/services/collectivites.service';
import SheetService from '../../utils/google-sheets/sheet.service';
import ListDefinitionsService from '../definitions/list-definitions.service';
import { IndicateurValeur } from '../models/indicateur-valeur.table';
import { IndicateurValeur } from '../shared/models/indicateur-valeur.table';
import IndicateurSourcesService from '../sources/indicateur-sources.service';
import CrudValeursService from '../valeurs/crud-valeurs.service';
import TrajectoiresDataService from './trajectoires-data.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import { EpciType } from '../../collectivites/shared/models/epci.table';
import {
SourceMetadonnee,
SourceMetadonneeInsert,
} from '../models/indicateur-source-metadonnee.table';
import { SourceInsert } from '../models/indicateur-source.table';
} from '../shared/models/indicateur-source-metadonnee.table';
import { SourceInsert } from '../shared/models/indicateur-source.table';
import {
IndicateurValeur,
IndicateurValeurAvecMetadonnesDefinition,
} from '../models/indicateur-valeur.table';
} from '../shared/models/indicateur-valeur.table';
import IndicateurSourcesService from '../sources/indicateur-sources.service';
import CrudValeursService from '../valeurs/crud-valeurs.service';
import { DonneesARemplirResultType } from './donnees-a-remplir-result.dto';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { EpciType } from '../../collectivites/shared/models/epci.table';
import ConfigurationService from '../../utils/config/configuration.service';
import SheetService from '../../utils/google-sheets/sheet.service';
import ListDefinitionsService from '../definitions/list-definitions.service';
import { IndicateurDefinition } from '../models/indicateur-definition.table';
import { IndicateurValeurInsert } from '../models/indicateur-valeur.table';
import { IndicateurDefinition } from '../shared/models/indicateur-definition.table';
import { IndicateurValeurInsert } from '../shared/models/indicateur-valeur.table';
import IndicateurSourcesService from '../sources/indicateur-sources.service';
import CrudValeursService from '../valeurs/crud-valeurs.service';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { extendApi } from '@anatine/zod-openapi';
import { z } from 'zod';
import { epciSchema } from '../../collectivites/shared/models/epci.table';
import { IndicateurValeur } from '../models/indicateur-valeur.table';
import { IndicateurValeur } from '../shared/models/indicateur-valeur.table';
import { donneesCalculTrajectoireARemplirSchema } from './donnees-calcul-trajectoire-a-remplir.dto';

export enum VerificationTrajectoireStatus {
Expand Down
6 changes: 3 additions & 3 deletions backend/src/indicateurs/valeurs/crud-valeurs.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { Body, Controller, Get, Logger, Post, Query } from '@nestjs/common';
import { ApiCreatedResponse, ApiResponse, ApiTags } from '@nestjs/swagger';
import { TokenInfo } from '../../auth/decorators/token-info.decorators';
import type { AuthenticatedUser } from '../../auth/models/auth.models';
import { getIndicateursValeursRequestSchema } from '../models/get-indicateurs.request';
import { getIndicateursValeursResponseSchema } from '../models/get-indicateurs.response';
import { getIndicateursValeursRequestSchema } from '../shared/models/get-indicateurs.request';
import { getIndicateursValeursResponseSchema } from '../shared/models/get-indicateurs.response';
import {
UpsertIndicateursValeursRequest,
UpsertIndicateursValeursResponse,
} from '../models/upsert-indicateurs-valeurs.request';
} from '../shared/models/upsert-indicateurs-valeurs.request';
import CrudValeursService from './crud-valeurs.service';

/**
Expand Down
12 changes: 6 additions & 6 deletions backend/src/indicateurs/valeurs/crud-valeurs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ import { groupBy, partition } from 'es-toolkit';
import * as _ from 'lodash';
import { AuthenticatedUser, AuthRole } from '../../auth/models/auth.models';
import { DatabaseService } from '../../utils/database/database.service';
import { DeleteIndicateursValeursRequestType } from '../models/delete-indicateurs.request';
import { GetIndicateursValeursRequestType } from '../models/get-indicateurs.request';
import { GetIndicateursValeursResponseType } from '../models/get-indicateurs.response';
import { DeleteIndicateursValeursRequestType } from '../shared/models/delete-indicateurs.request';
import { GetIndicateursValeursRequestType } from '../shared/models/get-indicateurs.request';
import { GetIndicateursValeursResponseType } from '../shared/models/get-indicateurs.response';
import {
IndicateurDefinition,
IndicateurDefinitionEssential,
indicateurDefinitionTable,
} from '../models/indicateur-definition.table';
} from '../shared/models/indicateur-definition.table';
import {
indicateurSourceMetadonneeTable,
SourceMetadonnee,
} from '../models/indicateur-source-metadonnee.table';
} from '../shared/models/indicateur-source-metadonnee.table';
import {
IndicateurAvecValeurs,
indicateurAvecValeursParSourceSchema,
Expand All @@ -42,7 +42,7 @@ import {
IndicateurValeurInsert,
indicateurValeursGroupeeParSourceSchema,
indicateurValeurTable,
} from '../models/indicateur-valeur.table';
} from '../shared/models/indicateur-valeur.table';

export class IndicateurValeurGroupee extends createZodDto(
extendApi(indicateurValeurGroupeeSchema)
Expand Down
2 changes: 1 addition & 1 deletion backend/src/plans/fiches/shared/edit-fiche.request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
serviceTagSchema,
structureTagSchema,
} from '@/backend/collectivites';
import { indicateurDefinitionSchema } from '@/domain/indicateurs';
import z from 'zod';
import { financeurTagSchema } from '../../../collectivites/shared/models/financeur-tag.table';
import { indicateurDefinitionSchema } from '../../../indicateurs/models/indicateur-definition.table';
import { actionRelationSchema } from '../../../referentiels/models/action-relation.table';
import { effetAttenduSchema } from '../../../shared/models/effet-attendu.table';
import { sousThematiqueSchema } from '../../../shared/models/sous-thematique.table';
Expand Down

0 comments on commit 2d0ce1c

Please sign in to comment.