Commit bd87d2bc authored by Hugo NOUTS's avatar Hugo NOUTS
Browse files

feat(findAllFormated Structure): Now return structures who gave consent

parent 8a7e4635
......@@ -222,6 +222,7 @@ export class StructuresService {
): Promise<StructureDocument[]> {
const structures = await this.structureModel.find({ deletedAt: { $exists: false } }).exec();
// Update structures coord and address before sending them
Logger.debug('Find all formated structures, only returning structures who consented to data sharing');
await Promise.all(
structures.map((structure: StructureDocument) => {
// If structure has no address, add it
......@@ -239,8 +240,8 @@ export class StructuresService {
);
return (
await this.structureModel
.find({ deletedAt: { $exists: false }, accountVerified: true })
.select('-_id -accountVerified -otherDescription')
.find({ deletedAt: { $exists: false }, accountVerified: true, $where: 'this.dataShareConsentDate != null' })
.select('-_id -accountVerified -otherDescription -dataShareConsentDate')
.exec()
).map((structure) => {
// If structure has temp email, hide it
......
......@@ -708,6 +708,7 @@ export class StructuresServiceMock {
nbScanners: 1,
freeWorkShop: false,
accountVerified: true,
dataShareConsentDate: '2022-03-01T09:00:00.000Z',
createdAt: '2021-05-06T09:42:38.000Z',
updatedAt: '2021-05-06T09:42:50.000Z',
__v: 0,
......@@ -782,6 +783,7 @@ export class StructuresServiceMock {
nbScanners: 1,
freeWorkShop: false,
accountVerified: true,
dataShareConsentDate: '2022-03-01T09:00:00.000Z',
createdAt: '2021-05-06T09:42:38.000Z',
updatedAt: '2021-05-06T09:42:50.000Z',
__v: 0,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment