Skip to content

Commit

Permalink
feat(docs): add sort to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Oct 8, 2024
1 parent 43a0c65 commit 8284f06
Show file tree
Hide file tree
Showing 35 changed files with 98 additions and 146 deletions.
14 changes: 0 additions & 14 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ services:
MINIO_REGION: xxx
command: server /data --console-address ":9001"

# MinIO Console (facultatif, pour la gestion via une interface web)
minio-console:
image: minio/console
ports:
- "9001:9001"
environment:
CONSOLE_MINIO_SERVER: http://minio:9000
CONSOLE_PBKDF_PASSPHRASE: minioadmin
CONSOLE_PBKDF_SALT: minioadmin
CONSOLE_SECRET_KEY: minioadmin
CONSOLE_ACCESS_KEY: minioadmin
depends_on:
- minio

postgres:
image: postgis/postgis:15-3.4-alpine
container_name: domifa-postgres
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const usagerDocsRepository = myDataSource
.getRepository<UsagerDoc>(UsagerDocsTable)
.extend({
async getUsagerDocs(usagerRef: number, structureId: number) {
return this.find({
return await this.find({
where: {
usagerRef,
structureId,
Expand All @@ -18,6 +18,9 @@ export const usagerDocsRepository = myDataSource
createdAt: true,
createdBy: true,
},
order: {
createdAt: "DESC",
},
});
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function sendMail({
const to = [
{
address: user.email,
personalName: user.prenom + " " + user.nom,
personalName: `${user.prenom} ${user.nom}`,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function sendMail({
const to = [
{
address: user.email,
personalName: user.prenom + " " + user.nom,
personalName: `${user.prenom} ${user.nom}`,
},
];
const recipients = mailRecipientsFilter.filterRecipients(to, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function sendMail({
const to = [
{
address: user.email,
personalName: user.prenom + " " + user.nom,
personalName: `${user.prenom} ${user.nom}`,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function sendMail({
const to = [
{
address: user.email,
personalName: user.prenom + " " + user.nom,
personalName: `${user.prenom} ${user.nom}`,
},
];
const recipients = mailRecipientsFilter.filterRecipients(to, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function sendMail({
const to = [
{
address: user.email,
personalName: user.prenom + " " + user.nom,
personalName: `${user.prenom} ${user.nom}`,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function sendMail({
const to = [
{
address: user.email,
personalName: user.prenom + " " + user.nom,
personalName: `${user.prenom} ${user.nom}`,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function sendMail({
const to = [
{
address: user.email,
personalName: user.prenom + " " + user.nom,
personalName: `${user.prenom} ${user.nom}`,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ export class StructureDocController {
public async getStructureDocs(
@CurrentUser() user: UserStructureAuthenticated
) {
return structureDocRepository.findBy({ structureId: user.structureId });
return structureDocRepository.find({
where: { structureId: user.structureId },
order: { createdAt: "DESC" },
});
}

@Delete(":uuid")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class AgendaController {
description: "Entretien demande de domiciliation",
start: [annee, mois, jour, heure, minutes],
organizer: {
name: user.prenom + " " + user.nom,
name: `${user.prenom} ${user.nom}`,
email: user.email,
},
startInputType: "local",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function buildUsagers({
user: Pick<UserStructure, "id" | "structureId" | "prenom" | "nom">;
}): Partial<Usager>[] {
const now = new Date();
const agent = user.prenom + " " + user.nom;
const agent = `${user.prenom} ${user.nom}`;

return usagersRows.map((usagerRow) =>
buildUsager({
Expand Down
19 changes: 9 additions & 10 deletions packages/backend/src/usagers/controllers/usager-docs.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class UsagerDocsController {
@Res() res: Response
) {
const encryptionContext = crypto.randomUUID();
const userName = user.prenom + " " + user.nom;
const userName = `${user.prenom} ${user.nom}`;

const path = randomName(file);

Expand Down Expand Up @@ -183,16 +183,8 @@ export class UsagerDocsController {
@AllowUserStructureRoles("simple", "responsable", "admin")
public async getUsagerDocuments(
@Param("usagerRef", new ParseIntPipe()) usagerRef: number,
@CurrentUsager() currentUsager: Usager,
@CurrentUser() user: UserStructureAuthenticated
@CurrentUsager() currentUsager: Usager
): Promise<UsagerDoc[]> {
await this.appLogsService.create({
userId: user.id,
usagerRef,
structureId: user.structureId,
action: "USAGERS_DOCS_DOWNLOAD",
});

return usagerDocsRepository.getUsagerDocs(
usagerRef,
currentUsager.structureId
Expand All @@ -208,6 +200,13 @@ export class UsagerDocsController {
@CurrentUser() user: UserStructureAuthenticated,
@CurrentUsager() currentUsager: Usager
) {
await this.appLogsService.create({
userId: user.id,
usagerRef,
structureId: user.structureId,
action: "USAGERS_DOCS_DOWNLOAD",
});

const doc = await usagerDocsRepository.findOneBy({
uuid: docUuid,
usagerRef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class UsagersDecisionController {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@Param("usagerRef", new ParseIntPipe()) _usagerRef: number
): Promise<Usager> {
decision.userName = user.prenom + " " + user.nom;
decision.userName = `${user.prenom} ${user.nom}`;
decision.userId = user.id;
return this.usagersService.setDecision(usager, decision);
}
Expand Down Expand Up @@ -153,7 +153,7 @@ export class UsagersDecisionController {

const createdBy = {
userId: user.id,
userName: user.prenom + " " + user.nom,
userName: `${user.prenom} ${user.nom}`,
};

const newNote: Partial<UsagerNote> = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { UsagerHistoryStates } from "./../../_common/model/usager/history/UsagerHistoryStates.interface";
import { Usager, UsagerDecision, UsagerEntretien } from "@domifa/common";
import { Injectable } from "@nestjs/common";
import { UsagerHistoryStateCreationEvent } from "../../_common/model";
import {
UsagerHistoryStateCreationEvent,
UsagerHistoryStates,
} from "../../_common/model";
import {
getDecisionForStats,
getEntretienForStats,
Expand Down Expand Up @@ -140,7 +142,7 @@ export class UsagerHistoryStateService {
}

private async getLastHistoryState(usager: Pick<Usager, "uuid">) {
return usagerHistoryStatesRepository.findOne({
return await usagerHistoryStatesRepository.findOne({
where: {
usagerUUID: usager.uuid,
},
Expand Down
15 changes: 9 additions & 6 deletions packages/backend/src/usagers/services/usagers.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { usagerEntretienRepository } from "./../../database/services/usager/usagerEntretienRepository.service";
import { Injectable } from "@nestjs/common";
import { v4 as uuidv4 } from "uuid";
import { usagerRepository, UsagerTable } from "../../database";
import {
usagerEntretienRepository,
usagerRepository,
UsagerTable,
} from "../../database";
import {
UserStructure,
UserStructureProfile,
Expand Down Expand Up @@ -48,7 +51,7 @@ export class UsagersService {
uuid: uuidv4(),
dateDecision: now,
statut: "INSTRUCTION",
userName: user.prenom + " " + user.nom,
userName: `${user.prenom} ${user.nom}`,
userId: user.id,
dateFin: now,
dateDebut: now,
Expand Down Expand Up @@ -105,7 +108,7 @@ export class UsagersService {
dateFin: newDateFin,
statut: "INSTRUCTION",
userId: user.id,
userName: user.prenom + " " + user.nom,
userName: `${user.prenom} ${user.nom}`,
typeDom,
motif: null,
};
Expand Down Expand Up @@ -223,7 +226,7 @@ export class UsagersService {
): Promise<Usager> {
usager.rdv = {
userId: rdv.userId,
userName: user.prenom + " " + user.nom,
userName: `${user.prenom} ${user.nom}`,
dateRdv: rdv.dateRdv,
};

Expand All @@ -245,7 +248,7 @@ export class UsagersService {
}

public async export(structureId: number): Promise<StructureUsagerExport[]> {
return usagerRepository.find({
return await usagerRepository.find({
where: { structureId },
relations: {
entretien: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/util/getCreatedByUserStructure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export function getCreatedByUserStructure(
): UserStructureResume {
return {
userId: user.id,
userName: user.prenom + " " + user.nom,
userName: `${user.prenom} ${user.nom}`,
};
}
6 changes: 0 additions & 6 deletions packages/frontend/src/_common/model/_core/AppEntity.type.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/frontend/src/_common/model/_core/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/frontend/src/_common/model/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@index('./*', f => `export * from '${f.path}'`)
export * from "./_core";
export * from "./_general";
export * from "./interaction";
export * from "./stats";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { UserStructureCreatedBy } from "@domifa/common";
import { AppEntity } from "../../_core";
import { UserStructureCreatedBy, AppEntity } from "@domifa/common";
import { StructureCustomDocType } from "./StructureCustomDocType.type";

export type StructureDoc = AppEntity & {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@index('./*', f => `export * from '${f.path}'`)
export * from "./StructureCustomDocType.type";
export * from "./StructureDoc.type";
export * from "./StructureDocKeys.type";
export * from "./StructureDocTypesAvailable.type";
10 changes: 0 additions & 10 deletions packages/frontend/src/_common/model/usager/UsagerDoc.type.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Usager } from "@domifa/common";
import { AppEntity } from "../_core";
import { AppEntity, Usager } from "@domifa/common";

export type UsagerLight = AppEntity &
Pick<
Expand Down
1 change: 0 additions & 1 deletion packages/frontend/src/_common/model/usager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export * from "./entretien";
export * from "./form";
export * from "./HISTORY_ACTIONS.const";
export * from "./rdv";
export * from "./UsagerDoc.type";
export * from "./UsagerEcheanceInfos.type";
export * from "./UsagerLight.type";
export * from "./UsagersImportMode.type";
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
STRUCTURE_DOC_EXTENSIONS_LABELS,
STRUCTURE_DOC_ICONS,
StructureDoc,
UsagerDoc,
} from "../../../../../_common/model";
import { UsagerDoc } from "@domifa/common";

@Component({
selector: "app-display-table-image",
Expand Down
Loading

0 comments on commit 8284f06

Please sign in to comment.