🛠 Allow applications to manage the drive (#59)
* Now applications can manage the drive as they wish * Fix typo * Fix the access computation * Test if my code is the issue * Fix test if app exists * Fix test if app exists * Fix test if app exists
This commit is contained in:
@@ -11,7 +11,7 @@ export class ApplicationServiceImpl implements TdriveServiceProvider, Initializa
|
||||
}
|
||||
|
||||
async get(id: string, _: ExecutionContext): Promise<Application> {
|
||||
return (await this.list(_)).find((app: Application) => app.id === id);
|
||||
return (await this.list(_)).find((app: Application) => app?.id === id);
|
||||
}
|
||||
|
||||
async list(_: ExecutionContext): Promise<Application[]> {
|
||||
|
||||
@@ -18,19 +18,28 @@ export class CompanyApplicationServiceImpl implements TdriveServiceProvider, Ini
|
||||
pk: Pick<CompanyApplicationPrimaryKey, "company_id" | "application_id"> & { id?: string },
|
||||
context?: CompanyExecutionContext,
|
||||
): Promise<CompanyApplicationWithApplication> {
|
||||
const application = await gr.services.applications.marketplaceApps.get(
|
||||
pk.application_id,
|
||||
context,
|
||||
);
|
||||
try {
|
||||
const application = await gr.services.applications.marketplaceApps.get(
|
||||
pk.application_id,
|
||||
context,
|
||||
);
|
||||
|
||||
return {
|
||||
...{
|
||||
id: pk.application_id,
|
||||
company_id: pk.company_id,
|
||||
application_id: pk.application_id,
|
||||
},
|
||||
application: application,
|
||||
};
|
||||
if (!application?.id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
...{
|
||||
id: pk.application_id,
|
||||
company_id: pk.company_id,
|
||||
application_id: pk.application_id,
|
||||
},
|
||||
application: application,
|
||||
};
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async list<ListOptions>(
|
||||
|
||||
Reference in New Issue
Block a user