Organization Management
Relevant source files
The following files were used as context for generating this wiki page:
- apps/web/core/services/server/requests/organization-team.ts
- apps/mobile/app/services/client/requests/organization-team.ts
- apps/web/core/components/features/projects/add-or-edit-project/steps/review-summary.tsx
- apps/web/core/components/pages/settings/team/integration-setting.tsx
- apps/web/core/stores/user/user-organizations.ts
- README.md
- apps/web/core/stores/README.md
Organization and Team Management is a foundational feature of the Ever Teams platform, providing the hierarchical structure for all work management activities. It allows users to group work into distinct Organizations, which are further divided into Teams. Each Team serves as a container for related Projects, Tasks, and Members, enabling focused collaboration and access control.
This system is built upon the Ever Gauzy platform, leveraging its core ERP/CRM/HRM capabilities. The management of these entities is handled through a set of dedicated API endpoints and managed on the client-side using a global state management system. This structure is central to features like project management, time tracking, and integrations with third-party services like GitHub.
Sources: README.md, apps/web/core/services/server/requests/organization-team.ts
Core Concepts and Hierarchy
The platform organizes entities in a clear hierarchy, which is essential for data scoping and permissions. The primary entities involved in organization management are Organizations, Teams, Projects, and Members (Employees/Users).
Sources: apps/web/core/services/server/requests/organization-team.ts, apps/mobile/app/services/client/requests/organization-team.ts
Entity Hierarchy
The data model follows a top-down structure, where each level contains the next.
This diagram shows the hierarchical relationship between key entities in the system. A Tenant can have multiple Organizations, which in turn contain Teams, Projects, and Members.
Sources: apps/web/core/services/server/requests/organization-team.ts:10-14, apps/web/core/services/server/requests/organization-team.ts:121-125
Key Entities
| Entity | Description |
|---|---|
| Organization | The top-level container for a company or a large group. All teams, projects, and users belong to an organization. |
| Team | A sub-group within an organization, typically focused on a specific function or goal. A team consists of members and is associated with one or more projects. |
| Project | A container for tasks. When a team is created, a corresponding project is automatically created and associated with it. |
| Member | A user who is part of a team. Members are assigned roles, such as MANAGER or EMPLOYEE. |
Sources: README.md:19, apps/web/core/services/server/requests/organization-team.ts:10-18, apps/web/core/components/features/projects/add-or-edit-project/steps/review-summary.tsx:40-41
Client-Side State Management
The frontend application uses Jotai for global state management, organizing state atoms by feature domain. This ensures a scalable and maintainable state architecture.
Sources: apps/web/core/stores/README.md
Key State Atoms
The following Jotai atoms are central to managing organization and team data on the client:
| Atom | File | Description |
|---|---|---|
organizationTeamsState | user-organizations.ts | An array of IOrganizationTeam objects, holding all teams for the current organization. |
activeTeamState | user-organizations.ts | The currently selected IOrganizationTeam object. This is used throughout the UI to scope data and actions. |
organizationProjectsState | user-organizations.ts | An array of IOrganizationProject objects for the current organization. |
rolesState | user-organizations.ts | An array of available IRole objects, used for assigning permissions to team members. |
Sources: apps/web/core/stores/user/user-organizations.ts:11-14
Components access this state using the useAtomValue hook. For example, the IntegrationSetting component retrieves the active team to configure GitHub integrations.
// File: apps/web/core/components/pages/settings/team/integration-setting.tsx:29
import { activeTeamState } from '@/core/stores';
import { useAtomValue } from 'jotai';
// ...
const activeTeam = useAtomValue(activeTeamState);
Sources: apps/web/core/components/pages/settings/team/integration-setting.tsx:29, apps/web/core/components/features/projects/add-or-edit-project/steps/review-summary.tsx:34
API Endpoints for Team Management
Team management operations are handled by a set of RESTful API endpoints under the /organization-team path. Both the web and mobile applications provide services to interact with these endpoints.
Sources: apps/web/core/services/server/requests/organization-team.ts, apps/mobile/app/services/client/requests/organization-team.ts
| Function | HTTP Method & Path | Description |
|---|---|---|
createOrganizationTeamRequest | POST /organization-team | Creates a new team. This process also automatically creates an associated project for the team. |
updateOrganizationTeamRequest | PUT /organization-team/{id} | Updates an existing team's details, such as its name or members. |
deleteOrganizationTeamRequest | DELETE /organization-team/{id} | Deletes a team from the organization. |
getAllOrganizationTeamRequest | GET /organization-team | Fetches a paginated list of all teams for a given organization, with support for fetching related entities. |
getOrganizationTeamRequest | GET /organization-team/{id} | Fetches a single team by its ID, including detailed information and related entities. |
removeEmployeeOrganizationTeamRequest | DELETE /organization-team-employee/{employeeId} | Removes a specific employee from their team. |
removeUserFromAllTeam | DELETE /organization-team/teams/{userId} | Removes a user from all teams they are a member of within the organization. |
Sources: apps/web/core/services/server/requests/organization-team.ts, apps/mobile/app/services/client/requests/organization-team.ts
Data Flow and Relationships
Data flows from the API to the client, is stored in Jotai atoms, and then consumed by React components. The API supports fetching complex object graphs by specifying relations in the query.
Team Data Fetching
The getOrganizationTeamRequest and getAllOrganizationTeamRequest functions are used to retrieve team data. They allow specifying which related entities to include in the response, reducing the need for multiple API calls.
A typical request for team data includes relations to members, roles, employees, and projects.
// File: apps/web/core/services/server/requests/organization-team.ts:70-79
relations = [
'members',
'members.role',
'members.employee',
'members.employee.user',
'createdByUser',
'projects',
'projects.customFields.repository'
]
Sources: apps/web/core/services/server/requests/organization-team.ts:70-79, apps/mobile/app/services/client/requests/organization-team.ts:70-71
Entity Relationship Diagram
This diagram illustrates the relationships between the main entities involved in organization management, as reflected in the API relations.
Key Processes
Team Creation
Creating a team is a two-step process on the backend: a new project is created first, and then it is associated with the new team. This ensures that every team has at least one project from its inception.
This sequence diagram shows the flow for creating a new organization team, including the automatic creation of an associated project.
Sources: apps/web/core/services/server/requests/organization-team.ts:9-24, apps/mobile/app/services/client/requests/organization-team.ts:10-29
Automatic Role Assignment
When creating or editing a project, the system includes logic to automatically assign roles to members to ensure proper project governance.
- Manager Assignment: If a project has no members with the
MANAGERrole, the currently authenticated user is automatically assigned as the manager. If the user is already a member with a different role, their role is updated toMANAGER. - Default Member Role: If a member is added to a project without a specific role, they are automatically assigned the default
EMPLOYEErole.
This logic resides in the frontend and is applied before submitting the project creation or update request to the API.
Sources: apps/web/core/components/features/projects/add-or-edit-project/steps/review-summary.tsx:43-73
Conclusion
The Organization and Team management system is a cornerstone of the Ever Teams platform. It establishes a clear and scalable hierarchy for managing work, users, and permissions. Through a well-defined API and a reactive client-side state model, it provides the necessary foundation for complex features like collaborative project management, time tracking, and third-party integrations. The automatic creation of projects upon team creation and intelligent role assignments streamline the user experience and enforce consistent data structures.