feature: allow organizing by id within symlink indexes
This commit is contained in:
parent
02a518667b
commit
77765e9e60
2 changed files with 19 additions and 8 deletions
|
|
@ -14,6 +14,7 @@ interface FSDB_INDEXER_SYMLINKS_CONFIG_SHARED {
|
|||
id_field?: string;
|
||||
to_many?: boolean;
|
||||
organize?: (value: string) => string[];
|
||||
organize_id?: (value: string) => string[];
|
||||
}
|
||||
|
||||
interface FSDB_INDEXER_SYMLINKS_CONFIG_WITH_FIELD extends FSDB_INDEXER_SYMLINKS_CONFIG_SHARED {
|
||||
|
|
@ -191,7 +192,11 @@ export class FSDB_INDEXER_SYMLINKS<T> implements FSDB_INDEXER<T> {
|
|||
continue;
|
||||
}
|
||||
|
||||
organized_paths.push(`${item_id}.json`);
|
||||
if (this.config.organize_id) {
|
||||
organized_paths.push(...this.config.organize_id(item_id));
|
||||
} else {
|
||||
organized_paths.push(`${item_id}.json`);
|
||||
}
|
||||
}
|
||||
|
||||
const symlink_path = path.resolve(path.join(this.config.root, ...organized_paths));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue