Skip to content

Commit 3dcb442

Browse files
committed
fix: invite team member
1 parent 2698453 commit 3dcb442

21 files changed

+776
-321
lines changed

.env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ DATABASE_URL=postgresql://postgres:password@db:5432/commitflow
2323
BE_PORT=8000
2424
OPENAI_API_KEY=
2525
BASE_URL=http://localhost:8000
26+
FE_URL=http://localhost:3000
2627
API_KEY=""
2728
JWT_SECRET=""
2829

backend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "commitflow-api",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "Backend CommitFlow",
55
"author": "asepindrak",
66
"private": false,

backend/prisma/schema.prisma

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ model Comment {
139139
updatedAt DateTime?
140140
}
141141

142+
model Invite {
143+
id String @id @default(uuid())
144+
workspaceId String
145+
email String
146+
invitedBy String
147+
isInvited Boolean @default(false)
148+
createdAt DateTime @default(now())
149+
updatedAt DateTime?
150+
}
151+
142152
enum Role {
143153
USER
144154
ADMIN

backend/src/app.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { Injectable } from "@nestjs/common";
33
@Injectable()
44
export class AppService {
55
getHello(): string {
6-
return `CommitFlow API (1.1.2) is running!`;
6+
return `CommitFlow API (1.1.6) is running!`;
77
}
88
}

backend/src/project-management/dto/team.dto.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,11 @@ export class UpdateTeamMemberDto {
5757
@IsString()
5858
photo?: string;
5959
}
60+
61+
export class InviteTeamMemberDto {
62+
@IsString()
63+
email: string;
64+
65+
@IsString()
66+
workspaceId: string;
67+
}

backend/src/project-management/project-management.controller.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ import { ProjectManagementService } from "./project-management.service";
2323
import { CreateProjectDto, UpdateProjectDto } from "./dto/project.dto";
2424
import { CreateTaskDto, UpdateTaskDto, PatchTaskDto } from "./dto/task.dto";
2525
import { CreateCommentDto, UpdateCommentDto } from "./dto/comment.dto";
26-
import { CreateTeamMemberDto, UpdateTeamMemberDto } from "./dto/team.dto";
26+
import {
27+
CreateTeamMemberDto,
28+
InviteTeamMemberDto,
29+
UpdateTeamMemberDto,
30+
} from "./dto/team.dto";
2731
import { Request } from "express";
2832
import * as fs from "fs";
2933
import { join } from "path";
@@ -191,6 +195,17 @@ export class ProjectManagementController {
191195
return this.svc.deleteTeamMember(id);
192196
}
193197

198+
@Post("team/invite")
199+
inviteTeamMember(@Body() dto: InviteTeamMemberDto, @Req() req: any) {
200+
const userId = req.user.userId;
201+
return this.svc.inviteTeamMember(dto, userId);
202+
}
203+
204+
@Get("team/invite/:id")
205+
acceptInvite(@Param("id") id: string) {
206+
return this.svc.acceptInvite(id);
207+
}
208+
194209
// Simple uploads route (used by frontend if needed)
195210
@Post("upload")
196211
@UseInterceptors(FileInterceptor("file"))

0 commit comments

Comments
 (0)