Skip to content

Commit 59139d4

Browse files
authored
QA to preprod
qa to preprod
2 parents fabb419 + 41210db commit 59139d4

File tree

10 files changed

+861
-567
lines changed

10 files changed

+861
-567
lines changed

backend/src/api/bd/controllers/bd.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,26 @@ module.exports = createCoreController("api::bd.bd", ({ strapi }) => ({
282282
...query,
283283
});
284284

285+
for (const result of results) {
286+
if (result?.master_id) {
287+
// Check if master_id is not the same as id, if it is not the same fetch proposal by master_id and set master_proposal_created_at to that value
288+
if (result?.master_id?.toString() !== result?.id?.toString()) {
289+
// fetch proposal it is not in the proposals list because it is not active version
290+
let masterProposal = await strapi.entityService.findOne(
291+
'api::bd.bd',
292+
result?.master_id
293+
);
294+
295+
if (masterProposal) {
296+
result.master_proposal_created_at =
297+
masterProposal?.createdAt;
298+
}
299+
} else {
300+
result.master_proposal_created_at = result?.createdAt;
301+
}
302+
}
303+
}
304+
285305
const sanitizedResults = results.map((entity) => {
286306
if (entity?.bd_contact_information) {
287307
delete entity.bd_contact_information;

0 commit comments

Comments
 (0)