Skip to content

Commit 030b5ec

Browse files
Nathan PythonNathanPython2002
andcommitted
feat: add types on RecordService
Co-Authored-by: Nathan Python <nathan.python@hes-so.ch>
1 parent 85bb4d4 commit 030b5ec

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* RERO angular core
3+
* Copyright (C) 2025 RERO
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Affero General Public License as published by
7+
* the Free Software Foundation, version 3 of the License.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
import { Observable } from "rxjs";
19+
import { ActionStatus } from "../service/action-status.enum";
20+
21+
export interface InvenioRecord { created : string, id : string, links : object, metadata: object, updated : string }
22+
23+
export interface EsResult {
24+
aggregations : object,
25+
hits : {
26+
hits: InvenioRecord[],
27+
total : {
28+
relation : string,
29+
value : number
30+
}
31+
}
32+
}
33+
34+
export interface ExportFormat { endpoint: string, disableMaxRestResultsSize: boolean }
35+
36+
export interface ExportFormatConfig { label: string, url: string, disable : boolean, disabled_message: string }
37+
38+
export interface Url { link: string, external: boolean }
39+
40+
export interface AggregationsFilter {
41+
key: string;
42+
values: object[];
43+
}
44+
45+
export interface RecordsAggregation {
46+
doc_count: number,
47+
type : string,
48+
config: any,
49+
name: string,
50+
buckets: any[]
51+
}
52+
53+
export type CanPermission = (record : InvenioRecord) => Observable<ActionStatus>;
54+
55+
export interface RecordPermissions {
56+
canAdd?: CanPermission;
57+
canUpdate?: CanPermission;
58+
canDelete?: CanPermission;
59+
canRead?: CanPermission;
60+
}
61+

0 commit comments

Comments
 (0)