Skip to content

Commit

Permalink
Fix some small things
Browse files Browse the repository at this point in the history
  • Loading branch information
amuwal committed Sep 13, 2024
1 parent 74fac19 commit 4409e9d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class SharepointService implements IFolderService {
statusCode: 201,
};
} catch (error) {
console.log(error.response?.data);
throw error;
}
}
Expand Down
9 changes: 2 additions & 7 deletions packages/api/src/filestorage/group/services/onedrive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class OnedriveService implements IGroupService {
private registry: ServiceRegistry,
) {
this.logger.setContext(
`${FileStorageObject.group.toUpperCase()}:${OnedriveService.name}`,
FileStorageObject.group.toUpperCase() + ':' + OnedriveService.name,
);
this.registry.registerService('onedrive', this);
}
Expand All @@ -34,12 +34,7 @@ export class OnedriveService implements IGroupService {
vertical: 'filestorage',
},
});

// remove /sites/site_id from account_url
const url = connection.account_url.replace(/\/sites\/.+$/, '');

// ref: https://learn.microsoft.com/en-us/graph/api/group-list?view=graph-rest-1.0&tabs=http
const resp = await axios.get(`${url}/groups`, {
const resp = await axios.get(`${connection.account_url}/v1.0/groups`, {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${this.cryptoService.decrypt(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class OnedriveGroupMapper implements IGroupMapper {
name: group.mailNickname,
remote_was_deleted: group.deletedDateTime !== null,
field_mappings,
users: null,
users: [],
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class SharepointService implements IGroupService {
private registry: ServiceRegistry,
) {
this.logger.setContext(
FileStorageObject.group.toUpperCase() + ':' + SharepointService.name,
`${FileStorageObject.group.toUpperCase()}:${SharepointService.name}`,
);
this.registry.registerService('sharepoint', this);
}
Expand All @@ -34,7 +34,11 @@ export class SharepointService implements IGroupService {
vertical: 'filestorage',
},
});
const resp = await axios.get(`${connection.account_url}/groups`, {
// remove /sites/site_id from account_url
const url = connection.account_url.replace(/\/sites\/.+$/, '');

// ref: https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http
const resp = await axios.get(`${url}/groups`, {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${this.cryptoService.decrypt(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class SharepointGroupMapper implements IGroupMapper {
name: group.mailNickname,
remote_was_deleted: group.deletedDateTime !== null,
field_mappings,
users: null,
users: [],
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class SharepointService implements IPermissionService {
private registry: ServiceRegistry,
) {
this.logger.setContext(
FileStorageObject.permission.toUpperCase() + ':' + SharepointService.name,
`${FileStorageObject.permission.toUpperCase()}:${SharepointService.name}`,
);
this.registry.registerService('sharepoint', this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class SharepointService implements ISharedLinkService {
private registry: ServiceRegistry,
) {
this.logger.setContext(
FileStorageObject.sharedlink.toUpperCase() + ':' + SharepointService.name,
`${FileStorageObject.sharedlink.toUpperCase()}:${SharepointService.name}`,
);
this.registry.registerService('sharepoint', this);
}
Expand Down

0 comments on commit 4409e9d

Please sign in to comment.