release: Agenda B0 (#214) → master #230

Closed
jmartin wants to merge 73 commits from develop into master
Showing only changes of commit 608e62d662 - Show all commits
+12 -2
View File
@@ -252,7 +252,12 @@ export class CardsService {
}
card.purge_at = this.purgeAt(card.type.retention_days, card.statut);
await this.cardsRepo.save(card);
// update() et non save() : save() avec relations responses/audience
// resynchronise les FK et tente UPDATE card_responses SET id_card=null.
await this.cardsRepo.update(
{ id: card.id },
{ statut: card.statut, purge_at: card.purge_at },
);
const full = await this.loadCard(cardId);
const dtoOut = this.toDto(full, userId);
this.emitAudience(full, 'response.added', {
@@ -304,7 +309,12 @@ export class CardsService {
};
card.statut = CardInstanceStatutType.OUVERTE;
card.purge_at = this.purgeAt(card.type.retention_days, card.statut);
await this.cardsRepo.save(card);
await this.cardsRepo.manager.query(
`UPDATE card_instances
SET statut = $1, purge_at = $2, payload = $3::jsonb, modifie_le = now()
WHERE id = $4`,
[card.statut, card.purge_at, JSON.stringify(card.payload), card.id],
);
const full = await this.loadCard(cardId);
const dtoOut = this.toDto(full, userId);
this.emitAudience(full, 'card.updated', dtoOut);