mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
add boolean to ignore folderId sorting, show all files on drive cleaner
This commit is contained in:
parent
216ab3aea7
commit
da54742291
2 changed files with 8 additions and 5 deletions
|
@ -46,6 +46,7 @@ export const paramDef = {
|
||||||
type: { type: 'string', nullable: true, pattern: /^[a-zA-Z\/\-*]+$/.toString().slice(1, -1) },
|
type: { type: 'string', nullable: true, pattern: /^[a-zA-Z\/\-*]+$/.toString().slice(1, -1) },
|
||||||
sort: { type: 'string', nullable: true, enum: ['+createdAt', '-createdAt', '+name', '-name', '+size', '-size', null] },
|
sort: { type: 'string', nullable: true, enum: ['+createdAt', '-createdAt', '+name', '-name', '+size', '-size', null] },
|
||||||
searchQuery: { type: 'string', default: '' },
|
searchQuery: { type: 'string', default: '' },
|
||||||
|
notShowAll: { type: 'boolean', default: true },
|
||||||
},
|
},
|
||||||
required: [],
|
required: [],
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -63,10 +64,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const query = this.queryService.makePaginationQuery(this.driveFilesRepository.createQueryBuilder('file'), ps.sinceId, ps.untilId)
|
const query = this.queryService.makePaginationQuery(this.driveFilesRepository.createQueryBuilder('file'), ps.sinceId, ps.untilId)
|
||||||
.andWhere('file.userId = :userId', { userId: me.id });
|
.andWhere('file.userId = :userId', { userId: me.id });
|
||||||
|
|
||||||
if (ps.folderId) {
|
if (ps.notShowAll) {
|
||||||
query.andWhere('file.folderId = :folderId', { folderId: ps.folderId });
|
if (ps.folderId) {
|
||||||
} else {
|
query.andWhere('file.folderId = :folderId', { folderId: ps.folderId });
|
||||||
query.andWhere('file.folderId IS NULL');
|
} else {
|
||||||
|
query.andWhere('file.folderId IS NULL');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps.searchQuery.length > 0) {
|
if (ps.searchQuery.length > 0) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ const sortMode = ref('+size');
|
||||||
const pagination = {
|
const pagination = {
|
||||||
endpoint: 'drive/files' as const,
|
endpoint: 'drive/files' as const,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
params: computed(() => ({ sort: sortMode.value })),
|
params: computed(() => ({ sort: sortMode.value, notShowAll: false })),
|
||||||
offsetMode: true,
|
offsetMode: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue