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: "",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
user: [user] || [],
|
||||
user: user ? [user] : [],
|
||||
});
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ export default class NotificationBuilder {
|
||||
redirection_url: "",
|
||||
created_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`);
|
||||
return;
|
||||
} else if (userRawData.status !== 200) {
|
||||
console.error(`Error fetching user data for ${user.uid}: ${userRawData.status} - ${userRawData.statusText}`);
|
||||
console.error(await userRawData.text());
|
||||
console.error(`Error fetching user data for ${user.uid}: ${userRawData.status} - ${userRawData.body}`);
|
||||
console.error(JSON.stringify(await userRawData.json()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -258,7 +258,6 @@ export default class IdNotService extends BaseService {
|
||||
let rattachements: any;
|
||||
|
||||
console.log("Fetching rattachements for user", user.uid);
|
||||
console.log(searchParams.toString());
|
||||
try {
|
||||
rattachements = await fetch(`${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/personnes/${user.idNot}/rattachements?deleted=false` + searchParams, {
|
||||
method: "GET",
|
||||
@ -272,7 +271,7 @@ export default class IdNotService extends BaseService {
|
||||
console.error(`User ${user.uid} not found in idnot`);
|
||||
return;
|
||||
} 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;
|
||||
}
|
||||
|
||||
@ -282,6 +281,9 @@ export default class IdNotService extends BaseService {
|
||||
return;
|
||||
}
|
||||
const rattachementsResults = rattachements.result as IRattachementData[];
|
||||
|
||||
console.log("rattachementsResults", JSON.stringify(rattachementsResults));
|
||||
|
||||
if (!rattachementsResults) return;
|
||||
rattachementsResults.forEach(async (rattachement) => {
|
||||
if (rattachement.statutDuRattachement && !rattachement.deleted) {
|
||||
@ -565,17 +567,23 @@ export default class IdNotService extends BaseService {
|
||||
public async updateUsers() {
|
||||
const usersReq = await this.userService.getUsersToBeChecked();
|
||||
const users = User.hydrateArray<User>(usersReq);
|
||||
users.forEach(async (user) => {
|
||||
for (const user of users) {
|
||||
await this.updateUser(user.uid!);
|
||||
});
|
||||
await this.delay(500);
|
||||
};
|
||||
}
|
||||
|
||||
public async updateOffices() {
|
||||
const officesReq = await this.officeService.getOfficesToBeChecked();
|
||||
const offices = Office.hydrateArray<Office>(officesReq);
|
||||
console.log(`Updating ${offices.length} offices`);
|
||||
offices.forEach(async (office) => {
|
||||
for (const office of offices) {
|
||||
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