feat: Enhance reference validation and add support for Handle URLs
Some checks failed
CI Pipeline / japa-tests (push) Failing after 51s

- Updated reference validation to handle various identifier types including DOI, ISBN, ISSN, URN, and Handle.
- Improved regex patterns for DOI and Handle validation to correctly extract and validate identifiers from URLs.
- Added asynchronous checks to verify the existence of DOI and Handle URLs.
- Added asynchronous checks to verify the existence of  ISBNs
- Included detailed comments explaining the regex patterns and validation logic.
- Adjusted the validation logic to handle any URL prefix for Handle identifiers.
- Ensured that the Handle format `handle/20.500.12854/36478` is correctly validated.
- Updated the CI workflow to trigger on push and pull request events.
This commit is contained in:
Kaimbacher 2025-01-24 17:11:10 +01:00
parent 537c6fd81a
commit 2c4f51be68
12 changed files with 538 additions and 162 deletions

View file

@ -63,6 +63,15 @@ export default class QueryBuilderProvider {
public register() {
// Register your own bindings
// const ModelQueryBuilder = this.app.container.bind('@adonisjs/lucid/orm/ModelQueryBuilder');
// ModelQueryBuilder.macro('whereTrue', function (columnName: string) {
// return this.where(columnName, true);
// });
// ModelQueryBuilder.macro('whereFalse', function (columnName: string) {
// return this.where(columnName, false);
// });
}
public async boot() {
@ -73,15 +82,14 @@ export default class QueryBuilderProvider {
// let rolesPluck = {};
let rolesPluck: { [key: number]: any } = {};
const result = await this.exec();
result.forEach((user, index) => {
let idc;
result.forEach((user: { [key: string]: any }, index: number) => {
let idc: number;
if (!id) {
idc = index;
} else {
idc = user[id];
}
const value = user[valueColumn];
// rolesPluck[idc] = user.name;
const value: any = user[valueColumn];
rolesPluck[idc] = value;
});
return rolesPluck;