Project & Member Management
Relevant source files
The following files were used as context for generating this wiki page:
- src/main/java/org/example/coding_convention/project/controller/ProjectController.java
- src/main/java/org/example/coding_convention/project/service/ProjectService.java
- src/main/java/org/example/coding_convention/project/model/Project.java
- src/main/java/org/example/coding_convention/project_member/controller/ProjectMemberController.java
- src/main/java/org/example/coding_convention/project_member/service/ProjectMemberService.java
- src/main/java/org/example/coding_convention/project/model/ProjectDto.java
- src/main/java/org/example/coding_convention/project_member/model/ProjectMember.java
- src/main/resources/data.sql
The Project & Member Management module serves as the foundational authority for PhanesEditor, a collaborative web-based code editor. Its primary purpose is to define project boundaries, manage user access, and enforce permission-based controls for real-time collaboration features such as shared coding and group chatting.
This module ensures that only authorized participants—designated as project members—can access specific project resources, including files and communication channels. By centralizing project metadata and membership status, it facilitates the transition from standard HTTP-based CRUD operations to stateful, real-time WebSocket interactions.
Sources: README.md, src/main/java/org/example/coding_convention/project/model/Project.java
System Architecture and Data Models
The system utilizes a relational database structure to maintain the relationship between users, projects, and their respective roles. A project is created by a user (the creator) and can include multiple members with varying levels of authority.
Entity Relationship
The core of the management system resides in the Project and ProjectMember entities. A Project is linked to a User (as the creator) and maintains a list of ProjectMember records.
The diagram illustrates how the ProjectMember table acts as a many-to-many bridge between Users and Projects, while also storing the member's permission status.
Sources: src/main/resources/data.sql:85-115, src/main/java/org/example/coding_convention/project/model/Project.java:23-55
Data Models
| Field | Type | Description | Constraints |
|---|---|---|---|
idx | Integer | Unique identifier for the project | Primary Key |
projectName | String | Name of the workspace | Not Null (50 chars) |
language | Enum | Primary coding language (JAVA, PYTHON, etc.) | Not Null |
user | User | Reference to the project creator | Lazy Fetch |
status | Enum | Member role (ADMIN, USER) | Not Null |
Sources: src/main/java/org/example/coding_convention/project/model/Project.java:23-45, src/main/java/org/example/coding_convention/project_member/model/ProjectMember.java:21-36
Project Lifecycle Management
Creation Flow
When a project is created, the system automatically assigns the creator as an ADMIN and registers any invited members as USER.
The ProjectService handles this orchestration, ensuring that the relational integrity between the new project and its initial membership set is maintained.
Sources: src/main/java/org/example/coding_convention/project/service/ProjectService.java:36-65
Search and Retrieval
Projects can be discovered through various criteria, including name, creator email, or programming language. The ProjectQueryRepository utilizes QueryDSL to perform dynamic searches.
- Search Criteria:
projectName(contains),email(contains),language(exact match). - Detail View: Retrieves a comprehensive snapshot including files, members, and recent chat history.
Sources: src/main/java/org/example/coding_convention/project/repository/ProjectQueryRepository.java:21-46, src/main/java/org/example/coding_convention/project/model/ProjectDto.java:54-75
Membership and Access Control
Membership is the gateway to collaboration. The ProjectMemberService allows for the manual addition of users to an existing project by their nickname.
API Endpoints for Member Management
| Method | Endpoint | Description |
|---|---|---|
POST | /project/create | Creates a new project and initializes membership. |
GET | /project/list | Returns all projects the current user is a member of. |
GET | /project/read | Retrieves detailed info (files, members, chats) for a specific project. |
POST | /project/member/create | Adds a specific user to a project with a defined role. |
Sources: src/main/java/org/example/coding_convention/project/controller/ProjectController.java:29-65, src/main/java/org/example/coding_convention/project_member/controller/ProjectMemberController.java:21-25
Role-Based Access Logic
The system distinguishes between ADMIN and USER statuses within the ProjectMember entity. While both can participate in real-time features, the ADMIN status is typically granted to the creator to manage project-level settings.
Technical Implementation Details
Project Initialization Snippet
The following logic demonstrates how a project and its initial membership are persisted in a single transactional flow.
// Sources: [src/main/java/org/example/coding_convention/project/service/ProjectService.java:36-65]
public ProjectDto.ProjectRes save(ProjectDto.ProjectReq dto, UserDto.AuthUser authUser) {
User userIdx = User.builder().idx(authUser.getIdx()).build();
Project project = projectRepository.save(dto.toEntity("test", userIdx));
// Automatically add creator as ADMIN
ProjectMemberDto.ProjectMemberReq memberDto = ProjectMemberDto.ProjectMemberReq.builder()
.projectId(project.getIdx())
.userId(userIdx.getIdx())
.status("ADMIN")
.build();
projectMemberRepository.save(memberDto.toEntity());
// Add invited members as USER
for (Integer memIdx : dto.getMemberIdx()) {
ProjectMemberDto.ProjectMemberReq projectMembers = ProjectMemberDto.ProjectMemberReq.builder()
.projectId(project.getIdx())
.userId(memIdx)
.status("USER")
.build();
projectMemberRepository.save(projectMembers.toEntity());
}
return ProjectDto.ProjectRes.from(project);
}
Summary
Project & Member Management provides the structural framework for collaboration within PhanesEditor. By linking users to projects through a dedicated membership entity and enforcing roles (ADMIN/USER), the system effectively manages access to shared resources like files and real-time communication channels. This module ensures that collaborative efforts are organized, searchable, and restricted to authorized participants.