Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Allow edit and delete for tech stack item #152

Merged
merged 29 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
52d9f19
add voyage team member Id to techStackItem
Ajen07 May 12, 2024
cbfd4c1
updated seed data to connect to voyageTeamMemberId
Ajen07 May 12, 2024
9773f7b
added member id to addNewTeamTech
Ajen07 May 12, 2024
ad7674b
added update endpoint for tech stack item
Ajen07 May 12, 2024
adb7df5
minor change
Ajen07 May 12, 2024
3e2679e
added delete endpoint for tech stack item and some minor changes
Ajen07 May 12, 2024
a80a621
minor changes
Ajen07 May 12, 2024
969eecf
added e2e tests for patch endpoint
Ajen07 May 13, 2024
8410b87
added e2e tests for delete end point and some minor changes
Ajen07 May 13, 2024
969cb81
minor changes in swagger doc
Ajen07 May 13, 2024
dc1dd18
Merge branch 'dev' of https://github.com/chingu-x/chingu-dashboard-be…
Ajen07 May 14, 2024
31e6c22
updated channellog.md
Ajen07 May 14, 2024
6d3bc27
updated all tests of tech from bearer token to http cookie
Ajen07 May 15, 2024
9a8df9c
changed unauthorized resp to forbidden resp
Ajen07 May 15, 2024
8c5d250
added custom request type for req argument
Ajen07 May 15, 2024
39c9edf
updated the endpoints for tech
Ajen07 May 18, 2024
0d14a52
updated patch and delete endpoints with new url
Ajen07 May 19, 2024
2c820b0
updated vote endpoints
Ajen07 May 19, 2024
9d56cb7
updated e2e tests of patch/delete endpoint of tech item
Ajen07 May 19, 2024
7e2490f
updated vote endpoint
Ajen07 May 19, 2024
0caf4de
Merge branch 'dev' of https://github.com/chingu-x/chingu-dashboard-be…
Ajen07 May 19, 2024
027eb66
minor changes
Ajen07 May 19, 2024
c12a069
added check for valid team id and team member id and related tests
Ajen07 May 20, 2024
4fa309c
restrict edit/delete if it has votes other than the owner
Ajen07 May 20, 2024
bf5dddb
added ability for last voter to edit/delete the tech item
Ajen07 May 24, 2024
1c3cc5e
Merge branch 'dev' of https://github.com/chingu-x/chingu-dashboard-be…
Ajen07 May 24, 2024
cc6e4a0
Merge branch 'dev' of https://github.com/chingu-x/chingu-dashboard-be…
Ajen07 May 25, 2024
a60dd71
added more descriptive error messages
Ajen07 May 27, 2024
415ca69
Merge branch 'dev' into feature/allow_edit_and_delete_for_tech_stack_…
Ajen07 May 30, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ Another example [here](https://co-pilot.dev/changelog)
- Add CASL ability for Access control ([#141](https://github.com/chingu-x/chingu-dashboard-be/pull/141))
- Add sprint checkin form submission status for a user ([#149](https://github.com/chingu-x/chingu-dashboard-be/pull/149))
- new command to run both e2e and unit test ([#148](https://github.com/chingu-x/chingu-dashboard-be/pull/148))
- allow edit and delete for tech stack item([#152](https://github.com/chingu-x/chingu-dashboard-be/pull/152))
- Add voyage project submission status to `/me` endpoint ([#158](https://github.com/chingu-x/chingu-dashboard-be/pull/158))


### Changed

- Update docker compose and scripts in package.json to include a test database container and remove usage of .env.dev to avoid confusion ([#100](https://github.com/chingu-x/chingu-dashboard-be/pull/100))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "TeamTechStackItem" ADD COLUMN "voyageTeamMemberId" INTEGER;

-- AddForeignKey
ALTER TABLE "TeamTechStackItem" ADD CONSTRAINT "TeamTechStackItem_voyageTeamMemberId_fkey" FOREIGN KEY ("voyageTeamMemberId") REFERENCES "VoyageTeamMember"("id") ON DELETE SET NULL ON UPDATE CASCADE;
19 changes: 11 additions & 8 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ model VoyageTeamMember {
teamResources TeamResource[]
projectFeatures ProjectFeature[]
checkinForms FormResponseCheckin[]
TeamTechStackItem TeamTechStackItem[]
@@unique(fields: [userId, voyageTeamId], name: "userVoyageId")
}
Expand All @@ -242,13 +243,15 @@ model TechStackCategory {
}

model TeamTechStackItem {
id Int @id @default(autoincrement())
name String @db.Citext
category TechStackCategory? @relation(fields: [categoryId], references: [id], onUpdate: Cascade, onDelete: SetNull)
categoryId Int?
voyageTeam VoyageTeam @relation(fields: [voyageTeamId], references: [id], onUpdate: Cascade, onDelete: Cascade)
voyageTeamId Int
isSelected Boolean @default(false)
id Int @id @default(autoincrement())
name String @db.Citext
category TechStackCategory? @relation(fields: [categoryId], references: [id], onUpdate: Cascade, onDelete: SetNull)
categoryId Int?
voyageTeam VoyageTeam @relation(fields: [voyageTeamId], references: [id], onUpdate: Cascade, onDelete: Cascade)
voyageTeamId Int
isSelected Boolean @default(false)
addedBy VoyageTeamMember? @relation(fields: [voyageTeamMemberId], references: [id], onUpdate: Cascade, onDelete: SetNull)
voyageTeamMemberId Int?
createdAt DateTime @default(now()) @db.Timestamptz()
updatedAt DateTime @updatedAt
Expand Down Expand Up @@ -292,7 +295,7 @@ model ProjectIdea {
title String
description String
vision String
isSelected Boolean @default(false)
isSelected Boolean @default(false)
createdAt DateTime @default(now()) @db.Timestamptz()
updatedAt DateTime @updatedAt
Expand Down
56 changes: 48 additions & 8 deletions prisma/seed/voyage-teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1073,11 +1073,16 @@ export const populateVoyageTeams = async () => {
create: {
votedBy: {
connect: {
id: voyageTeamMembers[0].id,
id: voyageTeamMembers[7].id,
},
},
},
},
addedBy: {
connect: {
id: voyageTeamMembers[7].id,
},
},
},
],
},
Expand All @@ -1102,11 +1107,16 @@ export const populateVoyageTeams = async () => {
create: {
votedBy: {
connect: {
id: voyageTeamMembers[2].id,
id: voyageTeamMembers[6].id,
},
},
},
},
addedBy: {
connect: {
id: voyageTeamMembers[6].id,
},
},
},
],
},
Expand All @@ -1131,11 +1141,16 @@ export const populateVoyageTeams = async () => {
create: {
votedBy: {
connect: {
id: voyageTeamMembers[2].id,
id: voyageTeamMembers[6].id,
},
},
},
},
addedBy: {
connect: {
id: voyageTeamMembers[6].id,
},
},
},
],
},
Expand All @@ -1160,11 +1175,16 @@ export const populateVoyageTeams = async () => {
create: {
votedBy: {
connect: {
id: voyageTeamMembers[1].id,
id: voyageTeamMembers[5].id,
},
},
},
},
addedBy: {
connect: {
id: voyageTeamMembers[5].id,
},
},
},
],
},
Expand All @@ -1189,11 +1209,16 @@ export const populateVoyageTeams = async () => {
create: {
votedBy: {
connect: {
id: voyageTeamMembers[0].id,
id: voyageTeamMembers[7].id,
},
},
},
},
addedBy: {
connect: {
id: voyageTeamMembers[7].id,
},
},
},
],
},
Expand All @@ -1218,11 +1243,16 @@ export const populateVoyageTeams = async () => {
create: {
votedBy: {
connect: {
id: voyageTeamMembers[3].id,
id: voyageTeamMembers[4].id,
},
},
},
},
addedBy: {
connect: {
id: voyageTeamMembers[4].id,
},
},
},
],
},
Expand All @@ -1247,11 +1277,16 @@ export const populateVoyageTeams = async () => {
create: {
votedBy: {
connect: {
id: voyageTeamMembers[2].id,
id: voyageTeamMembers[6].id,
},
},
},
},
addedBy: {
connect: {
id: voyageTeamMembers[6].id,
},
},
},
],
},
Expand All @@ -1276,11 +1311,16 @@ export const populateVoyageTeams = async () => {
create: {
votedBy: {
connect: {
id: voyageTeamMembers[3].id,
id: voyageTeamMembers[7].id,
},
},
},
},
addedBy: {
connect: {
id: voyageTeamMembers[7].id,
},
},
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { AbilitiesGuard } from "./auth/guards/abilities.guard";
path: "/",
module: ResourcesModule,
},
{ path: "teams/:teamId/techs", module: TechsModule },
{ path: "/", module: TechsModule },
{ path: "/", module: FeaturesModule },
{
path: "teams/:teamId/ideations",
Expand Down
5 changes: 5 additions & 0 deletions src/techs/dto/create-tech.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ export class CreateTeamTechDto {
@IsNotEmpty()
@ApiProperty({ example: 1 })
techCategoryId: number;

@IsInt()
@IsNotEmpty()
@ApiProperty({ example: 8 })
voyageTeamMemberId: number;
}
9 changes: 9 additions & 0 deletions src/techs/dto/update-tech.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsString } from "class-validator";

export class UpdateTeamTechDto {
@IsString()
@IsNotEmpty()
@ApiProperty({ example: "Typescipt" })
techName: string;
}
Loading
Loading