Search by firstName or lastName on notaries
This commit is contained in:
parent
ed7edef021
commit
4f446cad5d
@ -250,13 +250,13 @@ app.get('/api/notaries', async (req, res) => {
|
|||||||
url += `&ctmNomUsuel=${lastName}`;
|
url += `&ctmNomUsuel=${lastName}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await (
|
const json = await (
|
||||||
await fetch(`${url}&` + searchParams, {
|
await fetch(`${url}&` + searchParams, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
).json();
|
).json();
|
||||||
|
|
||||||
result.result = result.result.map(r => {
|
json.result = json.result.map(r => {
|
||||||
return {
|
return {
|
||||||
id: r.uid,
|
id: r.uid,
|
||||||
activity: r.activite,
|
activity: r.activite,
|
||||||
@ -265,12 +265,14 @@ app.get('/api/notaries', async (req, res) => {
|
|||||||
firstName: r.prenom,
|
firstName: r.prenom,
|
||||||
crpcen: r.numeroAdherentCrpcen,
|
crpcen: r.numeroAdherentCrpcen,
|
||||||
lastModified: r.lastModified,
|
lastModified: r.lastModified,
|
||||||
delete: r.delete
|
deleted: r.deleted
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
result.totalPages = Math.ceil(result.totalResultCount / result.size);
|
|
||||||
|
|
||||||
res.json(result);
|
json.totalPages = Math.ceil(json.totalResultCount / json.size);
|
||||||
|
delete json.totalResultCount;
|
||||||
|
|
||||||
|
res.json(json);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).json({
|
res.status(500).json({
|
||||||
error: 'Internal Server Error',
|
error: 'Internal Server Error',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user