Skip to content

Commit

Permalink
Merge pull request #152 from chingu-x/feature/allow_edit_and_delete_f…
Browse files Browse the repository at this point in the history
…or_tech_stack_item

Feature: Allow edit and delete for tech stack item
  • Loading branch information
Ajen07 authored May 31, 2024
2 parents fc0dde7 + 415ca69 commit f09f28a
Show file tree
Hide file tree
Showing 11 changed files with 669 additions and 161 deletions.
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

0 comments on commit f09f28a

Please sign in to comment.