Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
9f14ae59ff |
@ -2,14 +2,14 @@ name: Build and Push to Registry
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ env_235 ]
|
branches: [ main ]
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [closed]
|
types: [closed]
|
||||||
branches: [ env_235 ]
|
branches: [ main ]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: git.4nkweb.com
|
REGISTRY: git.4nkweb.com
|
||||||
IMAGE_NAME: 4nk/lecoffre-back-mini-235
|
IMAGE_NAME: 4nk/lecoffre-back-mini
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
@ -128,7 +128,7 @@ app.post('/api/v1/idnot/user/:code', async (req, res) => {
|
|||||||
const params = {
|
const params = {
|
||||||
client_id: 'B3CE56353EDB15A9',
|
client_id: 'B3CE56353EDB15A9',
|
||||||
client_secret: '3F733549E879878344B6C949B366BB5CDBB2DB5B7F7AB7EBBEBB0F0DD0776D1C',
|
client_secret: '3F733549E879878344B6C949B366BB5CDBB2DB5B7F7AB7EBBEBB0F0DD0776D1C',
|
||||||
redirect_uri: 'https://lecoffreio.4nkweb.com/authorized-client',
|
redirect_uri: 'http://local.lecoffreio.4nkweb:3000/authorized-client',
|
||||||
grant_type: 'authorization_code',
|
grant_type: 'authorization_code',
|
||||||
code: code
|
code: code
|
||||||
};
|
};
|
||||||
@ -665,69 +665,32 @@ app.post('/api/subscribe-to-list', validateEmail, async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/:uid/send_reminder', validateEmail, async (req, res) => {
|
app.post('/api/send_reminder', async (req, res) => {
|
||||||
const { email, documentsUid } = req.body;
|
const { office, customer } = req.body;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const uid = req.params["uid"];
|
const to = customer.contact.email;
|
||||||
if (!uid) {
|
|
||||||
//this.httpBadRequest(response, "No uid provided");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!documentsUid || !Array.isArray(documentsUid)) {
|
|
||||||
//this.httpBadRequest(response, "Invalid or missing documents");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
const documentEntities: Documents[] = [];
|
|
||||||
//For each document uid, use DocumentsService.getByUid to get the document entity and add it to the documents array
|
|
||||||
for (const documentUid of documentsUid) {
|
|
||||||
const documentEntity = await this.documentsService.getByUid(documentUid, { document_type: true, folder: true });
|
|
||||||
|
|
||||||
if (!documentEntity) {
|
|
||||||
this.httpBadRequest(response, "Document not found");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
documentEntities.push(documentEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
const customerEntity = await this.customersService.getByUid(uid, { contact: true, office: true });
|
|
||||||
|
|
||||||
if (!customerEntity) {
|
|
||||||
this.httpNotFoundRequest(response, "customer not found");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Hydrate ressource with prisma entity
|
|
||||||
const customer = Customer.hydrate < Customer > (customerEntity, { strategy: "excludeAll" });
|
|
||||||
|
|
||||||
// Call service to send reminder with documents
|
|
||||||
await this.customersService.sendDocumentsReminder(customer, documentEntities);
|
|
||||||
*/
|
|
||||||
|
|
||||||
const templateVariables = {
|
const templateVariables = {
|
||||||
first_name: 'firstName' || '',
|
office_name: office.name,
|
||||||
last_name: 'lastName' || '',
|
last_name: customer.contact.last_name || '',
|
||||||
office_name: 'officeName' || '',
|
first_name: customer.contact.first_name || '',
|
||||||
link: `${process.env.APP_HOST}`
|
link: `${process.env.APP_HOST}`
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await EmailService.sendTransactionalEmail(
|
await EmailService.sendTransactionalEmail(
|
||||||
email,
|
to,
|
||||||
ETemplates.DOCUMENT_REMINDER,
|
ETemplates.DOCUMENT_REMINDER,
|
||||||
'Votre notaire vous envoie un message',
|
'Vous avez des documents à déposer pour votre dossier.',
|
||||||
templateVariables
|
templateVariables
|
||||||
);
|
);
|
||||||
console.log(result);
|
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
message: 'Email envoyé avec succès'
|
message: 'Email envoyé avec succès'
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user