Skip to content
Merged

Dev #23

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
5 changes: 5 additions & 0 deletions .changeset/salty-bats-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"commitflow": patch
---

fix send email to member
4 changes: 2 additions & 2 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "commitflow-api",
"version": "1.1.8",
"version": "1.1.9",
"description": "Backend CommitFlow",
"author": "asepindrak",
"private": false,
Expand Down
37 changes: 20 additions & 17 deletions backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ model TeamMember {
isAdmin Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime?
Task Task[]
Task Task[] @relation("TaskMembers")
TaskCreatedBy Task[] @relation("TaskCreatedBy")

// FK ke Workspace
workspace Workspace? @relation("WorkspaceMembers", fields: [workspaceId], references: [id])
Expand Down Expand Up @@ -111,22 +112,24 @@ model Project {
}

model Task {
id String @id @default(uuid())
title String
description String?
status String @default("todo")
projectId String?
project Project? @relation("ProjectTasks", fields: [projectId], references: [id])
assigneeId String?
startDate String?
dueDate String?
priority String?
assignee TeamMember? @relation(fields: [assigneeId], references: [id])
isTrash Boolean @default(false)
comments Comment[] @relation("TaskComments")
clientId String? @unique
createdAt DateTime @default(now())
updatedAt DateTime?
id String @id @default(uuid())
title String
description String?
status String @default("todo")
projectId String?
project Project? @relation("ProjectTasks", fields: [projectId], references: [id])
assigneeId String?
startDate String?
dueDate String?
priority String?
assignee TeamMember? @relation("TaskMembers", fields: [assigneeId], references: [id])
isTrash Boolean @default(false)
comments Comment[] @relation("TaskComments")
clientId String? @unique
createdAt DateTime @default(now())
createdById String?
createdBy TeamMember? @relation("TaskCreatedBy", fields: [createdById], references: [id])
updatedAt DateTime?
}

model Comment {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { Injectable } from "@nestjs/common";
@Injectable()
export class AppService {
getHello(): string {
return `CommitFlow API (1.1.8) is running!`;
return `CommitFlow API (1.1.9) is running!`;
}
}
33 changes: 29 additions & 4 deletions backend/src/project-management/project-management.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,27 @@ export class ProjectManagementService {

//send email to team members
const teams = await prisma.teamMember.findMany({
where: { workspaceId: project.workspaceId, isTrash: false },
where: {
workspaceId: project.workspaceId,
isTrash: false,
OR: [
{ isAdmin: true },
{ id: data.assigneeId },
{ id: data.createdById },
],
},
select: { email: true },
});

const projectName = project?.name ?? "No Project";

const toEmails = teams.map((t) => t.email?.trim()).filter(Boolean);
const toEmails = Array.from(
new Set(
teams
.map((t) => t.email?.trim().toLowerCase()) // normalisasi
.filter(Boolean) // buang null/undefined/empty
)
);

if (toEmails.length === 0) throw new Error("No recipient emails found");
// Format tanggal
Expand Down Expand Up @@ -757,11 +771,22 @@ export class ProjectManagementService {

//send email to team members
const teams = await prisma.teamMember.findMany({
where: { workspaceId: p.workspaceId ?? "", isTrash: false },
where: {
workspaceId: p.workspaceId ?? "",
isTrash: false,
OR: [
{ isAdmin: true },
{ id: task.assigneeId ?? "" },
{ id: task.createdById ?? "" },
],
},
select: { email: true },
});

const toEmails = teams.map((t) => t.email?.trim()).filter(Boolean);
// Extract + normalize + deduplicate emails
const toEmails = Array.from(
new Set(teams.map((t) => t.email?.trim().toLowerCase()).filter(Boolean))
);

if (toEmails.length === 0) throw new Error("No recipient emails found");

Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "asepindrak",
"private": false,
"license": "MIT",
"version": "1.3.8",
"version": "1.3.9",
"type": "module",
"scripts": {
"dev": "vite --host 0.0.0.0",
Expand Down