Log error message body
All checks were successful
All checks were successful
This commit is contained in:
parent
70c481e545
commit
56a6f3dda2
@ -95,7 +95,7 @@ export default class NotificationBuilder {
|
|||||||
redirection_url: "",
|
redirection_url: "",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
user: [user] || [],
|
user: user ? [user] : [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ export default class NotificationBuilder {
|
|||||||
redirection_url: "",
|
redirection_url: "",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
user: [user] || [],
|
user: user ? [user] : [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,8 +245,8 @@ export default class IdNotService extends BaseService {
|
|||||||
console.error(`User ${user.uid} not found in idnot`);
|
console.error(`User ${user.uid} not found in idnot`);
|
||||||
return;
|
return;
|
||||||
} else if (userRawData.status !== 200) {
|
} else if (userRawData.status !== 200) {
|
||||||
console.error(`Error fetching user data for ${user.uid}: ${userRawData.status} - ${userRawData.statusText}`);
|
console.error(`Error fetching user data for ${user.uid}: ${userRawData.status} - ${userRawData.body}`);
|
||||||
console.error(await userRawData.text());
|
console.error(JSON.stringify(await userRawData.json()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +258,6 @@ export default class IdNotService extends BaseService {
|
|||||||
let rattachements: any;
|
let rattachements: any;
|
||||||
|
|
||||||
console.log("Fetching rattachements for user", user.uid);
|
console.log("Fetching rattachements for user", user.uid);
|
||||||
console.log(searchParams.toString());
|
|
||||||
try {
|
try {
|
||||||
rattachements = await fetch(`${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/personnes/${user.idNot}/rattachements?deleted=false` + searchParams, {
|
rattachements = await fetch(`${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/personnes/${user.idNot}/rattachements?deleted=false` + searchParams, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@ -272,7 +271,7 @@ export default class IdNotService extends BaseService {
|
|||||||
console.error(`User ${user.uid} not found in idnot`);
|
console.error(`User ${user.uid} not found in idnot`);
|
||||||
return;
|
return;
|
||||||
} else if (rattachements.status !== 200) {
|
} else if (rattachements.status !== 200) {
|
||||||
console.error(`Error fetching rattachements for ${user.uid}: ${rattachements.status} - ${rattachements.statusText}`);
|
console.error(`Error fetching rattachements for ${user.uid}: ${rattachements.status} - ${await rattachements.text()}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,6 +281,9 @@ export default class IdNotService extends BaseService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const rattachementsResults = rattachements.result as IRattachementData[];
|
const rattachementsResults = rattachements.result as IRattachementData[];
|
||||||
|
|
||||||
|
console.log("rattachementsResults", JSON.stringify(rattachementsResults));
|
||||||
|
|
||||||
if (!rattachementsResults) return;
|
if (!rattachementsResults) return;
|
||||||
rattachementsResults.forEach(async (rattachement) => {
|
rattachementsResults.forEach(async (rattachement) => {
|
||||||
if (rattachement.statutDuRattachement && !rattachement.deleted) {
|
if (rattachement.statutDuRattachement && !rattachement.deleted) {
|
||||||
@ -565,17 +567,23 @@ export default class IdNotService extends BaseService {
|
|||||||
public async updateUsers() {
|
public async updateUsers() {
|
||||||
const usersReq = await this.userService.getUsersToBeChecked();
|
const usersReq = await this.userService.getUsersToBeChecked();
|
||||||
const users = User.hydrateArray<User>(usersReq);
|
const users = User.hydrateArray<User>(usersReq);
|
||||||
users.forEach(async (user) => {
|
for (const user of users) {
|
||||||
await this.updateUser(user.uid!);
|
await this.updateUser(user.uid!);
|
||||||
});
|
await this.delay(500);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async updateOffices() {
|
public async updateOffices() {
|
||||||
const officesReq = await this.officeService.getOfficesToBeChecked();
|
const officesReq = await this.officeService.getOfficesToBeChecked();
|
||||||
const offices = Office.hydrateArray<Office>(officesReq);
|
const offices = Office.hydrateArray<Office>(officesReq);
|
||||||
console.log(`Updating ${offices.length} offices`);
|
console.log(`Updating ${offices.length} offices`);
|
||||||
offices.forEach(async (office) => {
|
for (const office of offices) {
|
||||||
await this.updateOffice(office.uid!);
|
await this.updateOffice(office.uid!);
|
||||||
});
|
await this.delay(500);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private async delay(ms: number) {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user