Add search method to Files Service
Implemented a method to search for files in the database by limit, offset, and search term. This method enhances the service by providing a way to paginate and filter file results.
This commit is contained in:
parent
7b4792b612
commit
38634132ba
@ -123,6 +123,14 @@ export class FilesService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches for files in the database based on the provided search field, limit, and offset.
|
||||||
|
*
|
||||||
|
* @param {number} limit - The maximum number of results to return.
|
||||||
|
* @param {number} offset - The offset for the results.
|
||||||
|
* @param {string} searchField - The value to search for within the file names.
|
||||||
|
* @return {Promise<IWithCount<IFileTable>>} A promise that resolves to an object containing the count of files that match the search criteria, the provided limit, the current offset, and the matching data.
|
||||||
|
*/
|
||||||
public async search(limit: number, offset: number, searchField: string): Promise<IWithCount<IFileTable>> {
|
public async search(limit: number, offset: number, searchField: string): Promise<IWithCount<IFileTable>> {
|
||||||
try {
|
try {
|
||||||
const countResult = await this.database.use()
|
const countResult = await this.database.use()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user