All checks were successful
CI / container-job (push) Successful in 49s
- Modified Api/Authors.Controller.ts to use only personal types and sort by dataset_count. - Completely rewritten AvatarController.ts. - Added new Api/CollectionsController.ts for querying collections and collection_roles. - Modified Api/DatasetController.ts to preload titles, identifier and order by server_date_published. - Modified FileController.ts to serve files from /storage/app/data/ instead of /storage/app/public. - Added new Api/UserController for requesting submitters (getSubmitters). - Improved OaiController.ts with performant DB queries for better ResumptionToken handling. - Modified Submitter/DatasetController.ts by adding a categorize method for library classification. - Rewritten ResumptionToken.ts. - Improved TokenWorkerService.ts to utilize browser fingerprint. - Edited dataset.ts by adding the doiIdentifier property. - Enhanced person.ts to improve the fullName property. - Completely rewritten AsideMenuItem.vue component. - Updated CarBoxClient.vue to use TypeScript. - Added new CardBoxDataset.vue for displaying recent datasets on the dashboard. - Completely rewritten TableSampleClients.vue for the dashboard. - Completely rewritten UserAvatar.vue. - Made small layout changes in Dashboard.vue. - Added new Category.vue for browsing scientific collections. - Adapted the pinia store in main.ts. - Added additional routes in start/routes.ts and start/api/routes.ts. - Improved referenceValidation.ts for better ISBN existence checking. - NPM dependency updates.
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
import type { HttpContext } from '@adonisjs/core/http';
|
|
import Person from '#models/person';
|
|
// import Dataset from 'App/Models/Dataset';
|
|
|
|
// node ace make:controller Author
|
|
export default class AuthorsController {
|
|
public async index({}: HttpContext) {
|
|
// select * from gba.persons
|
|
// where exists (select * from gba.documents inner join gba.link_documents_persons on "documents"."id" = "link_documents_persons"."document_id"
|
|
// where ("link_documents_persons"."role" = 'author') and ("persons"."id" = "link_documents_persons"."person_id"));
|
|
const authors = await Person.query()
|
|
.where('name_type', 'Personal')
|
|
.whereHas('datasets', (dQuery) => {
|
|
dQuery.wherePivot('role', 'author');
|
|
})
|
|
.withCount('datasets', (query) => {
|
|
query.as('datasets_count');
|
|
})
|
|
.orderBy('datasets_count', 'desc');
|
|
|
|
return authors;
|
|
}
|
|
|
|
public async persons({ request }: HttpContext) {
|
|
const authors = Person.query().where('status', true);
|
|
|
|
if (request.input('filter')) {
|
|
// users = users.whereRaw('name like %?%', [request.input('search')])
|
|
const searchTerm = request.input('filter');
|
|
authors.whereILike('first_name', `%${searchTerm}%`).orWhereILike('last_name', `%${searchTerm}%`);
|
|
// .orWhere('email', 'like', `%${searchTerm}%`);
|
|
}
|
|
|
|
let persons = await authors;
|
|
return persons;
|
|
}
|
|
}
|