🔢 Shared with me filters (#79)
✨ feat: shared with me filters 🐛 Fix try to access the service with init 🌐 feat: shared with me i18n 🌐russian translation --------- Co-authored-by: Anton SHEPILOV <ashepilov@linagora.com>
This commit is contained in:
@@ -17,6 +17,10 @@ export type SearchDocumentsBody = {
|
||||
creator?: string;
|
||||
added?: string;
|
||||
};
|
||||
export type sharedWithMeFilterBody = {
|
||||
mime_type?: string;
|
||||
creator?: string;
|
||||
};
|
||||
|
||||
let publicLinkToken: null | string = null;
|
||||
let tdriveTabToken: null | string = null;
|
||||
@@ -132,12 +136,12 @@ export class DriveApiClient {
|
||||
);
|
||||
}
|
||||
|
||||
static async search(searchString: string, view?: string,options?: BaseSearchOptions) {
|
||||
static async search(searchString: string, view?: string, options?: BaseSearchOptions) {
|
||||
const companyId = options?.company_id ? options.company_id : Workspace.currentGroupId;
|
||||
const query = `/internal/services/documents/v1/companies/${companyId}/search`;
|
||||
const searchData = {
|
||||
search: searchString,
|
||||
view: view
|
||||
view: view,
|
||||
};
|
||||
const res = await Api.post<SearchDocumentsBody, { entities: DriveItem[] }>(query, searchData);
|
||||
this.logger.debug(
|
||||
@@ -149,11 +153,14 @@ export class DriveApiClient {
|
||||
return res;
|
||||
}
|
||||
|
||||
static async sharedWithMe(options?: BaseSearchOptions) {
|
||||
static async sharedWithMe(filter?: any, options?: BaseSearchOptions) {
|
||||
const companyId = options?.company_id ? options.company_id : Workspace.currentGroupId;
|
||||
const query = `/internal/services/documents/v1/companies/${companyId}/shared-with-me`;
|
||||
const filterData = {};
|
||||
const res = await Api.post<SearchDocumentsBody, { entities: DriveItem[] }>(query, filterData);
|
||||
const filterData = { mime_type: filter.mimeType, creator: filter.creator, view: "shared_with_me" };
|
||||
const res = await Api.post<sharedWithMeFilterBody, { entities: DriveItem[] }>(
|
||||
query,
|
||||
filterData,
|
||||
);
|
||||
this.logger.debug(
|
||||
`Drive shared with me by filter "${JSON.stringify(filterData)}". Found`,
|
||||
res.entities.length,
|
||||
|
||||
Reference in New Issue
Block a user