Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server
1 result
Show changes
Commits on Source (15)
...@@ -82,6 +82,10 @@ deploy_dev: ...@@ -82,6 +82,10 @@ deploy_dev:
test: test:
stage: test stage: test
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/node:14.15.4 image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/node:14.15.4
services:
- name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/elasticsearch:7.16.2
alias: elasticsearch
command: ['bin/elasticsearch', '-Expack.security.enabled=false', '-Ediscovery.type=single-node']
before_script: before_script:
- export GHOST_HOST_AND_PORT=http://localhost:2368 - export GHOST_HOST_AND_PORT=http://localhost:2368
- export GHOST_ADMIN_API_KEY=60142bc9e33940000156bccc:6217742e2671e322612e89cac9bab61fcd01822709fe5d8f5e6a5b3e54d5e6bb - export GHOST_ADMIN_API_KEY=60142bc9e33940000156bccc:6217742e2671e322612e89cac9bab61fcd01822709fe5d8f5e6a5b3e54d5e6bb
......
...@@ -2,31 +2,19 @@ ...@@ -2,31 +2,19 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [1.15.0](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/compare/v1.13.0...v1.15.0) (2022-02-21) ### [1.15.1](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/compare/v1.15.0...v1.15.1) (2022-03-08)
### Features ### Features
* **cicd:** add variables for mr job ([59a5b63](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/59a5b63541a8a46ed1fba87732a85191a31c7c5f)) * **consent:** add open data consent ([5d4a88e](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/5d4a88e68efc07c2435eed6e7be6ee6d10306d1a))
* **cicd:** rework on automation. Add feature and tag build. Better handling of dependencie proxy ([bae2362](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/bae236298040d7d660876c8b0d4edae0d64d202b))
* **logger:** restrict logging for production ([1fb3c7f](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/1fb3c7f2a4b534e90fa7d9439390c0aa1a17e31d))
* **orientation-form:** structure search apply global filters ([63b6464](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/63b6464e5c9216f2638f38e28bb4ce15b5e012b4))
* **post:** add docker persistent storage for ghost files ([b634839](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/b634839efb922f97dbb134d9d00750673dee47a5))
* **searchResults:** Add descriptions to pages created with script ([14402a4](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/14402a4e890fe4719787f8ab975466dca0174877))
### Bug Fixes ### Bug Fixes
* **cicd:** fix deploy issue after variables adding ([555631c](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/555631cec956e765f615614afab5b4af636fe15e)) * **init:** fix id init script ([b68da92](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/b68da928ef516991cdd416116e98995c616f73ad))
* **cicd:** fix test issue ([8933076](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/89330762025de43dc81da08b99ea79736fe53138))
* **cicd:** issue on testing pipeline after variable adding ([365e973](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/365e9736d4684465e1dc0f14aace7f6a22b54ff6))
* **cicd:** update .gitlab-ci ([5d56874](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/5d56874e20e66e6b14f8a701bd5784c7e443eacd))
* **cicd:** update variables ([ee769e8](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/ee769e8a219d2ca2ee60fdd2681d503fb7c3a8e5))
* **cicd:** variable usage was making deploy job fail ([dd1d187](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/dd1d187e2667e35500536e22c13815eb4697f4c5))
* solve incomplete creation of ghost elements in init script ([3dce694](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/3dce694654056011e459a4e18d7397c778e5aaa0))
* update index create root url ([404a625](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/commit/404a62594e2567ecbc661a2e6b80c4385246cd27))
## [1.14.0](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/compare/v1.13.0...v1.14.0) (2022-02-21) ## [1.15.0](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server/compare/v1.13.0...v1.15.0) (2022-02-21)
### Features ### Features
......
{ {
"name": "ram_server", "name": "ram_server",
"version": "1.15.0", "version": "1.15.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
......
{ {
"name": "ram_server", "name": "ram_server",
"private": true, "private": true,
"version": "1.15.0", "version": "1.15.1",
"description": "Nest TypeScript starter repository", "description": "Nest TypeScript starter repository",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
......
...@@ -759,5 +759,79 @@ module.exports = { ...@@ -759,5 +759,79 @@ module.exports = {
nbScanners: 1, nbScanners: 1,
otherDescription: null, otherDescription: null,
}, },
{
_id: mongoose.Types.ObjectId('61e9260c2ac971550065e262'),
coord: [4.88428, 45.727292],
equipmentsAndServices: [],
digitalCultureSecurity: ['2', '5', '9', '28', '34', '39', '42', '51', '52', '54', '65', '96', '97', '98'],
parentingHelp: ['3', '22', '82', '94'],
socialAndProfessional: ['6', '20', '66', '67', '68', '69', '124', '125', '127'],
accessRight: ['84', '85', '86', '87', '88', '89', '93', '95'],
baseSkills: ['1', '11', '38', '48', '74', '77'],
proceduresAccompaniment: [],
publicsAccompaniment: [],
publics: ['toutPublic'],
labelsQualifications: ['passNumerique'],
accessModality: ['accesLibre'],
structureName: "Maison Lyon pour l'Emploi - Lyon 8",
contactPhone: '04 04 04 04 04',
contactMail: 'a@a.com',
structureType: 'autre',
pmrAccess: false,
remoteAccompaniment: false,
accountVerified: true,
freeWorkShop: false,
nbComputers: 0,
nbPrinters: 0,
nbScanners: 0,
nbTablets: 0,
nbNumericTerminal: 0,
address: {
numero: '172',
street: 'Avenue Général Frère',
commune: 'Lyon',
},
createdAt: 'Thu Jan 20 2022 10:06:20 GMT+0100 (heure normale d’Europe centrale)',
updatedAt: 'Thu Jan 20 2022 10:06:20 GMT+0100 (heure normale d’Europe centrale)',
dataShareConsentDate: null,
__v: 0,
},
{
_id: mongoose.Types.ObjectId('61e9260b2ac971550065e261'),
coord: [4.844309, 45.865288],
equipmentsAndServices: [],
digitalCultureSecurity: ['2', '5', '9', '28', '34', '39', '42', '51', '52', '54', '65', '96', '97', '98'],
parentingHelp: ['3', '22', '82', '94'],
socialAndProfessional: ['6', '20', '66', '67', '68', '69', '124', '125', '127'],
accessRight: ['84', '85', '86', '87', '88', '89', '93', '95'],
baseSkills: ['1', '11', '38', '48', '74', '77'],
proceduresAccompaniment: [],
publicsAccompaniment: [],
publics: ['toutPublic'],
labelsQualifications: ['passNumerique'],
accessModality: ['accesLibre'],
structureName: 'mon assistant numérique val de saone',
contactPhone: '04 04 04 04 04',
contactMail: 'a@a.com',
structureType: 'autre',
pmrAccess: false,
remoteAccompaniment: false,
accountVerified: true,
freeWorkShop: false,
nbComputers: 0,
nbPrinters: 0,
nbScanners: 0,
nbTablets: 0,
nbNumericTerminal: 0,
address: {
numero: '2',
street: 'Rue Neuve',
commune: 'Fleurieu-sur-Saône',
},
createdAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
updatedAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
dataShareConsentDate: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
__v: 0,
},
], ],
}; };
...@@ -39,6 +39,8 @@ module.exports = { ...@@ -39,6 +39,8 @@ module.exports = {
structuresLink: [ structuresLink: [
mongoose.Types.ObjectId('6001a38516b08100062e4161'), mongoose.Types.ObjectId('6001a38516b08100062e4161'),
mongoose.Types.ObjectId('6001a3aa16b08100062e4166'), mongoose.Types.ObjectId('6001a3aa16b08100062e4166'),
mongoose.Types.ObjectId('61e9260c2ac971550065e262'),
mongoose.Types.ObjectId('61e9260b2ac971550065e261'),
], ],
newEmail: null, newEmail: null,
changeEmailToken: null, changeEmailToken: null,
......
...@@ -214,6 +214,44 @@ async function createPages(deleteOnly) { ...@@ -214,6 +214,44 @@ async function createPages(deleteOnly) {
.catch((error) => console.error(error)); .catch((error) => console.error(error));
} }
async function createPages(deleteOnly) {
api.pages
.browse({ limit: 'all' })
.then(async (existingPages) => {
// remove 'meta' key
delete existingPages['meta'];
if (existingPages.length > 0) {
console.log(`-- Dropping ${existingPages.length} pages... --`);
// Delete existing pages
await deletePages(existingPages).then(() => {
console.log('-- Pages dropped --');
});
} else {
console.log('-- No pages to drop --');
}
// wait complete delete of pages, if not page slugs are appended by _2
await new Promise((r) => setTimeout(r, 1000));
// Creating new pages
if (!deleteOnly) {
console.log(`-- Creating ${pagesData.length} pages --`);
_.forEach(pagesData, async (page) => {
//upload de l'image en featured_image
if (page.feature_image) {
page.feature_image = await uploadPostImage(page.feature_image);
}
api.pages
.add(page, { source: 'html' })
.then((res) => {
console.log(`-- Page \`${res.title}\` created --`);
})
.catch((error) => console.error(error));
});
}
})
.catch((error) => console.error(error));
}
async function main(deleteOnly) { async function main(deleteOnly) {
createTags(deleteOnly) createTags(deleteOnly)
.then(() => { .then(() => {
......
...@@ -69,4 +69,5 @@ export class structureDto { ...@@ -69,4 +69,5 @@ export class structureDto {
digitalCultureSecurity: string[]; digitalCultureSecurity: string[];
coord: number[]; coord: number[];
accountVerified: boolean; accountVerified: boolean;
dataShareConsentDate: Date;
} }
...@@ -51,6 +51,7 @@ export class Structure { ...@@ -51,6 +51,7 @@ export class Structure {
this.coord = data.coord; this.coord = data.coord;
this.deletedAt = data.deletedAt; this.deletedAt = data.deletedAt;
this.accountVerified = data.accountVerified; this.accountVerified = data.accountVerified;
this.dataShareConsentDate = data.dataShareConsentDate;
} }
@Prop() @Prop()
...@@ -187,6 +188,9 @@ export class Structure { ...@@ -187,6 +188,9 @@ export class Structure {
@Prop() @Prop()
accountVerified: boolean; accountVerified: boolean;
@Prop()
dataShareConsentDate: Date;
} }
export const StructureSchema = SchemaFactory.createForClass(Structure); export const StructureSchema = SchemaFactory.createForClass(Structure);
......
...@@ -2,7 +2,7 @@ import { HttpModule } from '@nestjs/common'; ...@@ -2,7 +2,7 @@ import { HttpModule } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config'; import { ConfigModule } from '@nestjs/config';
import { getModelToken } from '@nestjs/mongoose'; import { getModelToken } from '@nestjs/mongoose';
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { CategoriesFormationsServiceMock } from '../../../test/mock/services/categoriesFormations.mock.service'; import { Types } from 'mongoose';
import { UsersServiceMock } from '../../../test/mock/services/user.mock.service'; import { UsersServiceMock } from '../../../test/mock/services/user.mock.service';
import { CategoriesFormationsService } from '../../categories/services/categories-formations.service'; import { CategoriesFormationsService } from '../../categories/services/categories-formations.service';
import { ConfigurationService } from '../../configuration/configuration.service'; import { ConfigurationService } from '../../configuration/configuration.service';
...@@ -13,6 +13,12 @@ import { structureDto } from '../dto/structure.dto'; ...@@ -13,6 +13,12 @@ import { structureDto } from '../dto/structure.dto';
import { Structure, StructureDocument } from '../schemas/structure.schema'; import { Structure, StructureDocument } from '../schemas/structure.schema';
import { StructuresSearchService } from './structures-search.service'; import { StructuresSearchService } from './structures-search.service';
import { StructuresService } from './structures.service'; import { StructuresService } from './structures.service';
import { IUser } from '../../users/interfaces/user.interface';
import * as bcrypt from 'bcrypt';
function hashPassword() {
return bcrypt.hashSync(process.env.USER_PWD, process.env.SALT);
}
describe('StructuresService', () => { describe('StructuresService', () => {
let service: StructuresService; let service: StructuresService;
...@@ -375,6 +381,108 @@ describe('StructuresService', () => { ...@@ -375,6 +381,108 @@ describe('StructuresService', () => {
expect(res).toBeTruthy(); expect(res).toBeTruthy();
}); });
describe('getAllDataConsentPendingStructures', () => {
it('should get one empty consent', async () => {
const user = {
_id: '123',
validationToken:
'cf1c74c22cedb6b575945098db42d2f493fb759c9142c6aff7980f252886f36ee086574ee99a06bc99119079257116c959c8ec870949cebdef2b293666dbca42',
emailVerified: false,
email: 'jacques.dupont@mii.com',
password: hashPassword(),
role: 0,
newEmail: '',
changeEmailToken: '',
resetPasswordToken: null,
structuresLink: [
Types.ObjectId('620e510b7d8f26712c386be7'),
Types.ObjectId('620e51247d8f26712c386be9'),
Types.ObjectId('620e5236f25755550cb86dfd'),
],
pendingStructuresLink: [],
structureOutdatedMailSent: [],
name: 'Jacques',
surname: 'Dupont',
phone: '06 06 06 06 06',
} as IUser;
jest
.spyOn(service, 'findOne')
.mockResolvedValueOnce({
_id: Types.ObjectId('61e9260b2ac971550065e261'),
coord: [4.844309, 45.865288],
createdAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
updatedAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
__v: 0,
} as StructureDocument)
.mockResolvedValueOnce({
_id: Types.ObjectId('61e9260b2ac971550065e261'),
coord: [4.844309, 45.865288],
createdAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
updatedAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
dataShareConsentDate: null,
} as StructureDocument)
.mockResolvedValueOnce({
_id: Types.ObjectId('61e9260b2ac971550065e261'),
coord: [4.844309, 45.865288],
createdAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
updatedAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
dataShareConsentDate: new Date(),
} as StructureDocument);
let res = await service.getAllDataConsentPendingStructures(user);
expect(res.length).toBe(1);
});
it('should get no consent', async () => {
const user = {
_id: '123',
validationToken:
'cf1c74c22cedb6b575945098db42d2f493fb759c9142c6aff7980f252886f36ee086574ee99a06bc99119079257116c959c8ec870949cebdef2b293666dbca42',
emailVerified: false,
email: 'jacques.dupont@mii.com',
password: hashPassword(),
role: 0,
newEmail: '',
changeEmailToken: '',
resetPasswordToken: null,
structuresLink: [
Types.ObjectId('620e510b7d8f26712c386be7'),
Types.ObjectId('620e51247d8f26712c386be9'),
Types.ObjectId('620e5236f25755550cb86dfd'),
],
pendingStructuresLink: [],
structureOutdatedMailSent: [],
name: 'Jacques',
surname: 'Dupont',
phone: '06 06 06 06 06',
} as IUser;
jest
.spyOn(service, 'findOne')
.mockResolvedValueOnce({
_id: Types.ObjectId('61e9260b2ac971550065e261'),
coord: [4.844309, 45.865288],
createdAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
updatedAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
dataShareConsentDate: null,
__v: 0,
} as StructureDocument)
.mockResolvedValueOnce({
_id: Types.ObjectId('61e9260b2ac971550065e261'),
coord: [4.844309, 45.865288],
createdAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
updatedAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
dataShareConsentDate: null,
} as StructureDocument)
.mockResolvedValueOnce({
_id: Types.ObjectId('61e9260b2ac971550065e261'),
coord: [4.844309, 45.865288],
createdAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
updatedAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)',
dataShareConsentDate: new Date(),
} as StructureDocument);
let res = await service.getAllDataConsentPendingStructures(user);
expect(res.length).toBe(0);
});
});
it('should report structure Error', () => { it('should report structure Error', () => {
let res = service.reportStructureError('6093ba0e2ab5775cfc01ed3e', ''); let res = service.reportStructureError('6093ba0e2ab5775cfc01ed3e', '');
expect(res).toBeTruthy(); expect(res).toBeTruthy();
......
...@@ -672,4 +672,24 @@ export class StructuresService { ...@@ -672,4 +672,24 @@ export class StructuresService {
}) })
); );
} }
/**
* Retrieve all structure pending for data.grandlyon consent sharing.
* Case 1 : null value stands for 'no'
* Case 2: a date stands for 'yes'
* Case 3: no key in document when there is no reply to consent
* @param users {IUser}
* @returns {Structure[]}
*/
public async getAllDataConsentPendingStructures(users: IUser): Promise<Structure[]> {
const data = await Promise.all(
users.structuresLink.map(async (structureId: Types.ObjectId) => {
const structure = await this.findOne(structureId.toHexString());
if (structure && structure.dataShareConsentDate === undefined) {
return structure;
}
})
);
return data.filter((value) => value);
}
} }
...@@ -90,6 +90,7 @@ describe('AuthController', () => { ...@@ -90,6 +90,7 @@ describe('AuthController', () => {
numero: null, numero: null,
deletedAt: null, deletedAt: null,
remoteAccompaniment: null, remoteAccompaniment: null,
dataShareConsentDate: null,
...structure, ...structure,
}); });
expect(res.structureName).toBe('a'); expect(res.structureName).toBe('a');
......
...@@ -273,6 +273,6 @@ export class StructuresController { ...@@ -273,6 +273,6 @@ export class StructuresController {
@Post('reportStructureError') @Post('reportStructureError')
public async reportStructureError(@Body() data: { structureId: string; content: string }): Promise<void> { public async reportStructureError(@Body() data: { structureId: string; content: string }): Promise<void> {
return await this.structureService.reportStructureError(data.structureId, data.content); return this.structureService.reportStructureError(data.structureId, data.content);
} }
} }
...@@ -10,6 +10,7 @@ import { UsersService } from './users.service'; ...@@ -10,6 +10,7 @@ import { UsersService } from './users.service';
import { StructuresService } from '../structures/services/structures.service'; import { StructuresService } from '../structures/services/structures.service';
import { TempUserService } from '../temp-user/temp-user.service'; import { TempUserService } from '../temp-user/temp-user.service';
import { ConfigurationService } from '../configuration/configuration.service'; import { ConfigurationService } from '../configuration/configuration.service';
import { Structure } from '../structures/schemas/structure.schema';
@Controller('users') @Controller('users')
export class UsersController { export class UsersController {
constructor( constructor(
...@@ -124,4 +125,10 @@ export class UsersController { ...@@ -124,4 +125,10 @@ export class UsersController {
}); });
return user; return user;
} }
@Get('dataConsentValidation')
@UseGuards(JwtAuthGuard)
public async dataConsentValidation(@Request() req): Promise<Structure[]> {
return this.structureService.getAllDataConsentPendingStructures(req.user);
}
} }