Browse Source

fix: Delete project by id instead of title

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/474/head
Pranav C 3 years ago
parent
commit
240b682a65
  1. 2
      packages/nocodb/src/lib/noco/NcProjectBuilder.ts
  2. 1
      packages/nocodb/src/lib/noco/meta/NcMetaIO.ts
  3. 6
      packages/nocodb/src/lib/noco/meta/NcMetaIOImpl.ts

2
packages/nocodb/src/lib/noco/NcProjectBuilder.ts

@ -436,7 +436,7 @@ export default class NcProjectBuilder {
case 'projectDelete':
this.router.stack.splice(0, this.router.stack.length);
this.apiBuilders.splice(0, this.apiBuilders.length);
await this.app.ncMeta.projectDelete(this.title);
await this.app.ncMeta.projectDeleteById(this.id);
await this.app.ncMeta.knex('nc_projects_users').where({project_id: this.id}).del();
for (const db of (this.config?.envs?.[this.appConfig?.workingEnv]?.db || [])) {
const dbAlias = db?.meta?.dbAlias;

1
packages/nocodb/src/lib/noco/meta/NcMetaIO.ts

@ -125,6 +125,7 @@ export default abstract class NcMetaIO {
public abstract projectGetById(projectId: string, encrypt?: boolean): Promise<any>;
public abstract projectDelete(title: string): Promise<any>;
public abstract projectDeleteById(id: string): Promise<any>;
public abstract startTransaction();

6
packages/nocodb/src/lib/noco/meta/NcMetaIOImpl.ts

@ -657,6 +657,12 @@ export default class NcMetaIOImpl extends NcMetaIO {
}).delete();
}
public projectDeleteById(id: string): Promise<any> {
return this.connection('nc_projects').where({
id
}).delete();
}
public async projectStatusUpdate(projectName: string, status: string): Promise<any> {
return this.connection('nc_projects').update({
status

Loading…
Cancel
Save