mirror of
https://github.com/docmost/docmost.git
synced 2025-11-22 04:11:09 +10:00
Refactoring
* Refactor workspace membership system * Create setup endpoint * Use Passport.js * Several updates and fixes
This commit is contained in:
@ -6,7 +6,6 @@ import {
|
||||
import { DataSource, EntityManager } from 'typeorm';
|
||||
import { GroupUserRepository } from '../respositories/group-user.repository';
|
||||
import { PaginationOptions } from '../../../helpers/pagination/pagination-options';
|
||||
import { WorkspaceUser } from '../../workspace/entities/workspace-user.entity';
|
||||
import { transactionWrapper } from '../../../helpers/db.helper';
|
||||
import { User } from '../../user/entities/user.entity';
|
||||
import { GroupUser } from '../entities/group-user.entity';
|
||||
@ -55,9 +54,10 @@ export class GroupUserService {
|
||||
groupId: string,
|
||||
workspaceId: string,
|
||||
manager?: EntityManager,
|
||||
): Promise<WorkspaceUser> {
|
||||
): Promise<any> {
|
||||
let addedUser;
|
||||
|
||||
/*
|
||||
await transactionWrapper(
|
||||
async (manager) => {
|
||||
const group = await manager.findOneBy(Group, {
|
||||
@ -106,7 +106,7 @@ export class GroupUserService {
|
||||
this.dataSource,
|
||||
manager,
|
||||
);
|
||||
|
||||
*/
|
||||
return addedUser;
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ export class GroupService {
|
||||
return await this.groupRepository.save(group);
|
||||
}
|
||||
|
||||
async getGroup(groupId: string, workspaceId: string): Promise<Group> {
|
||||
async getGroupInfo(groupId: string, workspaceId: string): Promise<Group> {
|
||||
const group = await this.groupRepository
|
||||
.createQueryBuilder('group')
|
||||
.where('group.id = :groupId', { groupId })
|
||||
@ -68,11 +68,11 @@ export class GroupService {
|
||||
return group;
|
||||
}
|
||||
|
||||
async getGroupsInWorkspace(
|
||||
async getWorkspaceGroups(
|
||||
workspaceId: string,
|
||||
paginationOptions: PaginationOptions,
|
||||
): Promise<PaginatedResult<Group>> {
|
||||
const [groupsInWorkspace, count] = await this.groupRepository
|
||||
const [groups, count] = await this.groupRepository
|
||||
.createQueryBuilder('group')
|
||||
.where('group.workspaceId = :workspaceId', { workspaceId })
|
||||
.loadRelationCountAndMap(
|
||||
@ -86,7 +86,7 @@ export class GroupService {
|
||||
|
||||
const paginationMeta = new PaginationMetaDto({ count, paginationOptions });
|
||||
|
||||
return new PaginatedResult(groupsInWorkspace, paginationMeta);
|
||||
return new PaginatedResult(groups, paginationMeta);
|
||||
}
|
||||
|
||||
async deleteGroup(groupId: string, workspaceId: string): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user