This commit is contained in:
VincentAlamelle 2024-02-16 16:03:35 +01:00 committed by GitHub
commit 9c6eac97fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 12 deletions

View File

@ -58,7 +58,7 @@
"file-type-checker": "^1.0.8",
"fp-ts": "^2.16.1",
"jsonwebtoken": "^9.0.0",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.106",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.108",
"module-alias": "^2.2.2",
"monocle-ts": "^2.3.13",
"multer": "^1.4.5-lts.1",

View File

@ -34,7 +34,7 @@ export default class UserController extends ApiController {
return;
}
const user = await this.idNotService.getOrCreateUser(idNotToken);
const user = await this.idNotService.getOrCreateUser(idNotToken);
if(!user) {
this.httpUnauthorized(response, "Email not found");
@ -47,10 +47,15 @@ export default class UserController extends ApiController {
if (!prismaUser) {
this.httpNotFoundRequest(response, "user not found");
return;
}
}
//Hydrate user to be able to use his contact
const userHydrated = User.hydrate<User>(prismaUser, { strategy: "excludeAll" });
const userHydrated = User.hydrate<User>(prismaUser, { strategy: "excludeAll" });
if(!userHydrated.contact?.email || userHydrated.contact?.email === "") {
this.httpUnauthorized(response, "Email not found");
return;
}
//Check if user is whitelisted
const isWhitelisted = await this.whitelistService.getByEmail(userHydrated.contact!.email);

View File

@ -168,7 +168,7 @@ export default class OfficeFoldersController extends ApiController {
const officeFolderFound = await this.officeFoldersService.getByUid(uid, {
folder_anchor: true,
});
});
if (!officeFolderFound) {
this.httpNotFoundRequest(response, "office folder not found");
@ -184,11 +184,6 @@ export default class OfficeFoldersController extends ApiController {
//validate folder
await validateOrReject(officefolderToUpdate, { groups: ["updateFolder"], forbidUnknownValues: false });
if ((officeFolderFound as any).folder_anchor?.status !== "VERIFIED_ON_CHAIN") {
this.httpBadRequest(response, "Cannot archive a not anchored folder");
return;
}
//call service to get prisma entity
const officeFolderEntityUpdated = await this.officeFoldersService.updateStatus(uid, officefolderToUpdate);

View File

@ -20,7 +20,6 @@ export default class DocumentTypesRepository extends BaseRepository {
* @description : Find many document types
*/
public async findMany(query: Prisma.DocumentTypesFindManyArgs) {
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
return this.model.findMany(query);
}

View File

@ -120,7 +120,9 @@ export default class IdNotService extends BaseService {
redirect_uri: this.variables.IDNOT_REDIRECT_URL,
code: code,
grant_type: "authorization_code",
});
});
console.log(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query.toString());
const token = await fetch(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query, { method: "POST" });
if(token.status !== 200) console.error(await token.text());