Browse Source

fix: user cleanup during project delete

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5835/head
Raju Udava 1 year ago
parent
commit
a639c8da5f
  1. 10
      packages/nocodb/src/models/Project.ts

10
packages/nocodb/src/models/Project.ts

@ -8,6 +8,7 @@ import {
import { extractProps } from '../helpers/extractProps';
import NocoCache from '../cache/NocoCache';
import Base from './/Base';
import { ProjectUser } from './index';
import type { BoolType, MetaType, ProjectType } from 'nocodb-sdk';
import type { DB_TYPES } from './/Base';
@ -276,6 +277,15 @@ export default class Project implements ProjectType {
// Todo: Remove the project entry from the connection pool in NcConnectionMgrv2
static async delete(projectId, ncMeta = Noco.ncMeta): Promise<any> {
const users = await ProjectUser.getUsersList({
project_id: projectId,
offset: 0,
limit: 1000,
});
for (const user of users) {
await ProjectUser.delete(projectId, user.id);
}
const bases = await Base.list({ projectId });
for (const base of bases) {
await base.delete(ncMeta);

Loading…
Cancel
Save