Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ export const companyInfoRepositoryExtension: ICompanyInfoRepository = {
.getOne();
},

async findFullCompanyInfoByCompanyId(companyId: string): Promise<CompanyInfoEntity> {
return await this.createQueryBuilder('company_info')
.leftJoinAndSelect('company_info.users', 'current_user')
.leftJoinAndSelect('company_info.users', 'users')
.leftJoinAndSelect('company_info.connections', 'connections')
.leftJoinAndSelect('company_info.invitations', 'invitations')
.leftJoinAndSelect('connections.groups', 'groups')
.leftJoinAndSelect('connections.author', 'connection_author')
.leftJoinAndSelect('groups.users', 'groups_users')
.where('company_info.id = :companyId', { companyId })
.getOne();
},

async findCompanyInfoByCompanyIdWithoutConnections(companyId: string): Promise<CompanyInfoEntity> {
return await this.createQueryBuilder('company_info')
.leftJoinAndSelect('company_info.users', 'current_user')
Expand Down Expand Up @@ -90,22 +77,6 @@ export const companyInfoRepositoryExtension: ICompanyInfoRepository = {
.getOne();
},

//todo deprecated code, will be removed in future
// async findAllCompanyWithConnectionsUsersJoining(companyId: string): Promise<CompanyInfoEntity> {
// return await this.createQueryBuilder('company_info')
// .leftJoinAndSelect('company_info.users', 'users')
// .leftJoinAndSelect('company_info.logo', 'logo')
// .leftJoinAndSelect('company_info.favicon', 'favicon')
// .leftJoinAndSelect('company_info.tab_title', 'tab_title')
// .leftJoinAndSelect('users.groups', 'groups')
// .leftJoinAndSelect('groups.connection', 'connections')
// .leftJoinAndSelect('connections.author', 'connection_author')
// .leftJoinAndSelect('connections.groups', 'connection_groups')
// .leftJoinAndSelect('connection_groups.users', 'connection_groups_users')
// .where('company_info.id = :companyId', { companyId })
// .getOne();
// },

async findCompanyInfosByUserEmail(userEmail: string): Promise<CompanyInfoEntity[]> {
return await this.createQueryBuilder('company_info')
.leftJoinAndSelect('company_info.users', 'users')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ export interface ICompanyInfoRepository {

findUserCompanyWithUsers(userId: string): Promise<CompanyInfoEntity>;

//todo deprecated code, will be removed in future
// findAllCompanyWithConnectionsUsersJoining(companyId: string): Promise<CompanyInfoEntity>;

findFullCompanyInfoByCompanyId(companyId: string): Promise<CompanyInfoEntity>;

findCompaniesPaidConnections(companyIds: Array<string>): Promise<ConnectionEntity[]>;

findCompanyFrozenPaidConnections(companyIds: Array<string>): Promise<Array<ConnectionEntity>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export interface IConnectionRepository {

findOneConnection(connectionId: string): Promise<ConnectionEntity>;

getConnectionAuthorIdByGroupInConnectionId(groupId: string): Promise<string>;

findAndDecryptConnection(connectionId: string, masterPwd: string): Promise<ConnectionEntity>;

removeConnection(connection: ConnectionEntity): Promise<ConnectionEntity>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,6 @@ export const customConnectionRepositoryExtension: IConnectionRepository = {
return await qb.getOne();
},

async getConnectionAuthorIdByGroupInConnectionId(groupId: string): Promise<string> {
const connectionQb = this.createQueryBuilder('connection')
.leftJoinAndSelect('connection.groups', 'group')
.leftJoinAndSelect('connection.author', 'author')
.andWhere('group.id = :id', { id: groupId });
const connection: ConnectionEntity = await connectionQb.getOne();
return connection.author.id;
},

async findOneById(connectionId: string): Promise<ConnectionEntity> {
return await this.findOne({ where: { id: connectionId } });
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ export const groupCustomRepositoryExtension: IGroupRepository = {
return await qb.getMany();
},

async countAllUserGroups(userId: string): Promise<number> {
const qb = this.createQueryBuilder('group')
.leftJoin('group.users', 'user')
.andWhere('user.id = :userId', { userId: userId });
return await qb.getCount();
},

async findAllUsersInGroup(groupId: string): Promise<Array<UserEntity>> {
const qb = this.manager
.getRepository(UserEntity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@ export interface IGroupRepository {
findGroupWithPermissionsById(groupId: string): Promise<GroupEntity>;

findAllUsersInGroupsWhereUserIsAdmin(userId: string, connectionId: string): Promise<Array<UserEntity>>;

countAllUserGroups(userId: string): Promise<number>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ export const permissionCustomRepositoryExtension = {
connectionId: string,
): Promise<Array<PermissionEntity>> {
const qb = this.createQueryBuilder('permission')
.leftJoinAndSelect('permission.groups', 'group')
.leftJoinAndSelect('group.users', 'user')
.leftJoinAndSelect('group.connection', 'connection')
.leftJoin('permission.groups', 'group')
.leftJoin('group.users', 'user')
.leftJoin('group.connection', 'connection')
.andWhere('connection.id = :connectionId', { connectionId: connectionId })
.andWhere('user.id = :userId', { userId: userId })
.andWhere('permission.type = :permissionType', { permissionType: PermissionTypeEnum.Table });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,9 @@ export class FindTablesInConnectionV2UseCase
}

const sortedTables = tablesRO.sort((tableRO1, tableRO2) => {
const display_name1 = tableRO1.display_name;
const display_name2 = tableRO2.display_name;
if (display_name1 && display_name2) {
return display_name1.localeCompare(display_name2);
}
if (!display_name1 && !display_name2) {
return tableRO1.table.localeCompare(tableRO2.table);
}
if (!display_name1 && display_name2) {
return tableRO1.table.localeCompare(display_name2);
}
if (display_name1 && !display_name2) {
return display_name1.localeCompare(tableRO2.table);
}
return 0;
const name1 = tableRO1.display_name || tableRO1.table;
const name2 = tableRO2.display_name || tableRO2.table;
return name1.localeCompare(name2);
});

const tableCategories = foundConnectionProperties?.table_categories || [];
Expand Down
Loading