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

Teams can create own tech categories #208

Merged
merged 28 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0eb6d78
added teamId foreign key to tech categories
JoshuaHinman Sep 5, 2024
ff3184a
seed tech categories after teams, before team memebers
JoshuaHinman Sep 8, 2024
d3d4403
added tech ctaegory create, patch, delete routes to controller
JoshuaHinman Sep 9, 2024
2c042c5
Added update and delete routes for techStackCategory
JoshuaHinman Sep 19, 2024
b9b4a97
dropped unique constraint from category names, also populated categor…
JoshuaHinman Sep 21, 2024
f2c62dc
Merge branch 'dev' into feature/teams-own-tech-categories
JoshuaHinman Sep 21, 2024
8c3ffc9
updated get teams/{teamId}/techs response, corrected 'isSelected' loc…
JoshuaHinman Sep 21, 2024
6bae8a0
misc revisions
JoshuaHinman Sep 21, 2024
ce7043b
updated changelog
JoshuaHinman Sep 21, 2024
42489a7
Update seed.ts - removed comment
JoshuaHinman Sep 21, 2024
524d8c9
Update tables.ts - removed comment
JoshuaHinman Sep 21, 2024
906f41a
Update seed.ts - comment
JoshuaHinman Sep 21, 2024
50fe8e1
changed voyageTeamId to optional to pass railway check
JoshuaHinman Sep 22, 2024
d89b108
Merge branch 'feature/teams-own-tech-categories' of https://github.co…
JoshuaHinman Sep 22, 2024
78d3341
Update prisma/schema/voyage.prisma
JoshuaHinman Sep 24, 2024
ac3bc08
Merge branch 'dev' into feature/teams-own-tech-categories
timDeHof Sep 26, 2024
83e852d
combined migrations, removed voyageTeamId from GET route body, remove…
JoshuaHinman Sep 29, 2024
115a92b
fixed linter error
JoshuaHinman Sep 29, 2024
39d21c6
Merge branch 'dev' into feature/teams-own-tech-categories
JoshuaHinman Oct 17, 2024
ec1fc81
updated URIs, updated DTOs, added case-insensitive category name query
JoshuaHinman Oct 17, 2024
f52bd59
Update techs.service.ts
JoshuaHinman Oct 17, 2024
7b28961
changed category name to citext type , added unique name AND teamId c…
JoshuaHinman Oct 17, 2024
bdc6700
removed isInt import from update category dto
JoshuaHinman Oct 17, 2024
04af186
added voyageteamIdNew column to category schema
JoshuaHinman Oct 20, 2024
f0456d6
Merge branch 'dev' into feature/teams-own-tech-categories
JoshuaHinman Oct 21, 2024
49af84a
revised categories schema , migrations
JoshuaHinman Oct 23, 2024
6d027c8
Update CHANGELOG.md
JoshuaHinman Oct 23, 2024
22ec4ad
Merge branch 'dev' into feature/teams-own-tech-categories
cherylli Oct 23, 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
## [Unreleased]

### Added

- Added same site property to the clear cookies function ([#218](https://github.com/chingu-x/chingu-dashboard-be/pull/218))
- Added routes for teams to create own tech stack categories([#208](https://github.com/chingu-x/chingu-dashboard-be/pull/208))

### Changed
- Updated cors origin list ([#218](https://github.com/chingu-x/chingu-dashboard-be/pull/218))
Expand Down Expand Up @@ -63,6 +65,7 @@
- Add units tests for the teams resource controller & services([#201](https://github.com/chingu-x/chingu-dashboard-be/pull/201))
- Add github workflow for PR reminders ([#202](https://github.com/chingu-x/chingu-dashboard-be/pull/202))


### Changed

- updated changelog ([#195](https://github.com/chingu-x/chingu-dashboard-be/pull/195))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Warnings:

- A unique constraint covering the columns `[name,voyageTeamId]` on the table `TechStackCategory` will be added. If there are existing duplicate values, this will fail.

*/
-- DropIndex
DROP INDEX "TechStackCategory_name_key";

-- AlterTable
ALTER TABLE "TechStackCategory" ADD COLUMN "voyageTeamId" INTEGER,
ALTER COLUMN "name" SET DATA TYPE CITEXT;

-- CreateIndex
CREATE UNIQUE INDEX "TechStackCategory_name_voyageTeamId_key" ON "TechStackCategory"("name", "voyageTeamId");

-- AddForeignKey
ALTER TABLE "TechStackCategory" ADD CONSTRAINT "TechStackCategory_voyageTeamId_fkey" FOREIGN KEY ("voyageTeamId") REFERENCES "VoyageTeam"("id") ON DELETE CASCADE ON UPDATE CASCADE;
10 changes: 7 additions & 3 deletions prisma/schema/teamStack.prisma
JoshuaHinman marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
// === Voyage - Tech stack ===

model TechStackCategory {
id Int @id @default(autoincrement())
name String @unique
description String
id Int @id @default(autoincrement())
name String @db.Citext
description String
voyageTeam VoyageTeam? @relation(fields: [voyageTeamId], references: [id], onUpdate: Cascade, onDelete: Cascade)
voyageTeamId Int?

createdAt DateTime @default(now()) @db.Timestamptz()
updatedAt DateTime @updatedAt

teamTechStackItems TeamTechStackItem[]

@@unique(fields: [name, voyageTeamId], name: "teamCategoryUniqueKey")
}

model TeamTechStackItem {
Expand Down
1 change: 1 addition & 0 deletions prisma/schema/voyage.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ model VoyageTeam {

voyageTeamMembers VoyageTeamMember[]
teamTechStackItems TeamTechStackItem[]
techStackCategory TechStackCategory[]
teamMeetings TeamMeeting[]
FormResponseVoyageProject FormResponseVoyageProject?
}
Expand Down
8 changes: 7 additions & 1 deletion prisma/seed/data/tech-stack-categories.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
export default [
export const techStackCategoriesData = [
{
name: "Frontend",
description: "Frontend Stuff",
voyageTeamId: 1,
},
{
name: "CSS Library",
description: "CSS Library",
voyageTeamId: 1,
},
{
name: "Backend",
description: "Backend Stuff",
voyageTeamId: 1,
},
{
name: "Project Management",
description: "project management Stuff",
voyageTeamId: 1,
},
{
name: "Cloud Provider",
description: "cloud stuff",
voyageTeamId: 1,
},
{
name: "Hosting",
description: "Hosting stuff",
voyageTeamId: 1,
},
];
2 changes: 1 addition & 1 deletion prisma/seed/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const deleteAllTables = async () => {

export const seed = async () => {
await deleteAllTables();
await populateTables(); // tables with no relations
await populateTables(); //tables with no relations
await populateVoyages();
await populateUsers();
await populateSprints();
Expand Down
2 changes: 0 additions & 2 deletions prisma/seed/tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Genders from "./data/genders";
import Tiers from "./data/tiers";
import VoyageRoles from "./data/voyage-roles";
import VoyageStatus from "./data/voyage-status";
import TechStackCategories from "./data/tech-stack-categories";

import FeatureCategories from "./data/feature-categories";

Expand All @@ -27,7 +26,6 @@ export const populateTables = async () => {
await populateTable("role", Roles);
await populateTable("voyageRole", VoyageRoles);
await populateTable("voyageStatus", VoyageStatus);
await populateTable("techStackCategory", TechStackCategories);
await populateTable("featureCategory", FeatureCategories);
await populateTable("formType", FormTypes);
await populateTable("inputType", InputTypes);
Expand Down
26 changes: 18 additions & 8 deletions prisma/seed/voyage-teams.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { prisma } from "./prisma-client";
import { techStackCategoriesData } from "./data/tech-stack-categories";

export const populateVoyageTeams = async () => {
const users = await prisma.user.findMany({});
Expand Down Expand Up @@ -1531,6 +1532,15 @@ export const populateVoyageTeams = async () => {
},
});

//Add Tech Stack Categories
for (let teamId = 1; teamId <= 11; teamId += 1) {
for (const category of techStackCategoriesData) {
category.voyageTeamId = teamId;
await prisma["TechStackCategory"].create({ data: category });
}
}
console.log("TechStackCategories populated");

const voyageTeamMembers = await prisma.voyageTeamMember.findMany({});

/* ============== Add tech stack items, etc to teams ================== */
Expand All @@ -1547,7 +1557,7 @@ export const populateVoyageTeams = async () => {
name: "Javascript",
category: {
connect: {
name: "Frontend",
id: 7,
},
},
teamTechStackItemVotes: {
Expand Down Expand Up @@ -1581,7 +1591,7 @@ export const populateVoyageTeams = async () => {
name: "React",
category: {
connect: {
name: "Frontend",
id: 7,
},
},
teamTechStackItemVotes: {
Expand Down Expand Up @@ -1615,7 +1625,7 @@ export const populateVoyageTeams = async () => {
name: "Tailwind",
category: {
connect: {
name: "CSS Library",
id: 8,
},
},
teamTechStackItemVotes: {
Expand Down Expand Up @@ -1649,7 +1659,7 @@ export const populateVoyageTeams = async () => {
name: "Node",
category: {
connect: {
name: "Backend",
id: 9,
},
},
teamTechStackItemVotes: {
Expand Down Expand Up @@ -1683,7 +1693,7 @@ export const populateVoyageTeams = async () => {
name: "Jira",
category: {
connect: {
name: "Project Management",
id: 10,
},
},
teamTechStackItemVotes: {
Expand Down Expand Up @@ -1717,7 +1727,7 @@ export const populateVoyageTeams = async () => {
name: "Azure",
category: {
connect: {
name: "Cloud Provider",
id: 11,
},
},
teamTechStackItemVotes: {
Expand Down Expand Up @@ -1751,7 +1761,7 @@ export const populateVoyageTeams = async () => {
name: "Netlify",
category: {
connect: {
name: "Hosting",
id: 12,
},
},
teamTechStackItemVotes: {
Expand Down Expand Up @@ -1785,7 +1795,7 @@ export const populateVoyageTeams = async () => {
name: "Java",
category: {
connect: {
name: "Backend",
id: 9,
},
},
teamTechStackItemVotes: {
Expand Down
2 changes: 1 addition & 1 deletion src/global/types/CustomRequest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Request } from "express";

type VoyageTeam = {
export type VoyageTeam = {
teamId: number;
memberId: number;
};
Expand Down
14 changes: 14 additions & 0 deletions src/techs/dto/create-techstack-category.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsString } from "class-validator";

export class CreateTechStackCategoryDto {
@IsString()
@IsNotEmpty()
@ApiProperty({ example: "CDN" })
name: string;

@IsString()
@IsNotEmpty()
@ApiProperty({ example: "Host for static resources" })
description: string;
}
2 changes: 1 addition & 1 deletion src/techs/dto/update-tech.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { IsNotEmpty, IsString } from "class-validator";
export class UpdateTeamTechDto {
@IsString()
@IsNotEmpty()
@ApiProperty({ example: "Typescipt" })
@ApiProperty({ example: "Typescript" })
techName: string;
}
14 changes: 14 additions & 0 deletions src/techs/dto/update-techstack-category.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsString } from "class-validator";

export class UpdateTechStackCategoryDto {
@IsString()
@IsNotEmpty()
@ApiProperty({ example: "ORM" })
newName: string;

@IsString()
@IsNotEmpty()
@ApiProperty({ example: "DB interface" })
description: string;
}
Loading
Loading