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/ideation endpoints v2 #20

Merged
merged 46 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a091d66
findAll update
Oct 16, 2023
db5318a
delete
Oct 16, 2023
4730ab0
createNew
Oct 16, 2023
72f675b
uncomment controller
Oct 16, 2023
ad31e9b
hardcode userid in create
Oct 16, 2023
61933c6
update schema as discussion
Oct 17, 2023
b656a7e
migration
Oct 17, 2023
0573526
changing endpoints in controller
Oct 17, 2023
34d3a90
updated endpoints in controller as the trello card specs
Oct 17, 2023
807d9fe
update Ideation folder to follow naming standards
smurph7894 Oct 19, 2023
66454e1
remove duplicate info
smurph7894 Oct 19, 2023
44a5213
create entity class
smurph7894 Oct 19, 2023
392a265
updating Ideation schema tables
smurph7894 Oct 19, 2023
ba45981
class validator package added
smurph7894 Oct 20, 2023
8fad7ec
dto files updated
smurph7894 Oct 20, 2023
f78a8b6
remove ternary on projectIdeaId
smurph7894 Oct 20, 2023
852a8f7
updating entity
smurph7894 Oct 20, 2023
084f0b3
Update ideations.service.ts
smurph7894 Oct 20, 2023
3798b32
Update ideations.controller.ts
smurph7894 Oct 20, 2023
6d8d6a8
Merge branch 'dev' into feature/ideation-endpoints-v2
smurph7894 Oct 20, 2023
04935d5
migrations
smurph7894 Oct 24, 2023
1a3c39a
update prisma table field name - ProjectIdea & ProjectIdeaVote
smurph7894 Oct 24, 2023
87bf5e3
update ideation dto files
smurph7894 Oct 24, 2023
363bf24
Update ideation.entity.ts
smurph7894 Oct 24, 2023
e517fc3
Update main.ts
smurph7894 Oct 24, 2023
6241b35
Create, Gets, Update and Deletes created and updated
smurph7894 Oct 24, 2023
329d19d
Merge branch 'dev' into feature/ideation-endpoints-v2
smurph7894 Oct 24, 2023
462eca2
squash migrations
smurph7894 Oct 24, 2023
edf1315
update Ideation controller & services
smurph7894 Oct 24, 2023
0b4c381
updating per Eslint check
smurph7894 Oct 24, 2023
877c95e
Update ideations.controller.ts
smurph7894 Oct 24, 2023
df16d32
Update ideations.service.ts
smurph7894 Oct 24, 2023
1f33529
Update ideations.controller.ts
smurph7894 Oct 24, 2023
e2fe46a
Update ideations.service.ts
smurph7894 Oct 24, 2023
688f50c
Update ideations.service.ts
smurph7894 Oct 24, 2023
9a7baf2
Group helper methods
smurph7894 Oct 24, 2023
7159233
updating userId to body
smurph7894 Oct 24, 2023
55e7d02
Update ideations.service.ts
smurph7894 Oct 24, 2023
caf4a5c
remove vote count from Ideations Get Controller
smurph7894 Oct 24, 2023
46fa747
Update ideations.service.ts
smurph7894 Oct 25, 2023
38a22ba
update getIdeationsByTeam endpoint query results
smurph7894 Oct 25, 2023
74c5102
change ProjectIdeaVote onDelete to cascade
smurph7894 Oct 25, 2023
75e120d
Update create-ideation.dto.ts
smurph7894 Oct 25, 2023
b171768
updated delete and createVote dto files
smurph7894 Oct 25, 2023
88903f1
Update ideations.service.ts
smurph7894 Oct 25, 2023
c9fb932
Update ideations.controller.ts
smurph7894 Oct 25, 2023
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
28 changes: 28 additions & 0 deletions prisma/migrations/20231024051234_ideations/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
Warnings:

- You are about to drop the column `userId` on the `ProjectIdea` table. All the data in the column will be lost.
- You are about to drop the column `userId` on the `ProjectIdeaVote` table. All the data in the column will be lost.
- Made the column `projectIdeaId` on table `ProjectIdeaVote` required. This step will fail if there are existing NULL values in that column.

*/
-- DropForeignKey
ALTER TABLE "ProjectIdea" DROP CONSTRAINT "ProjectIdea_userId_fkey";

-- DropForeignKey
ALTER TABLE "ProjectIdeaVote" DROP CONSTRAINT "ProjectIdeaVote_userId_fkey";

-- AlterTable
ALTER TABLE "ProjectIdea" DROP COLUMN "userId",
ADD COLUMN "voyageTeamMemberId" INTEGER;

-- AlterTable
ALTER TABLE "ProjectIdeaVote" DROP COLUMN "userId",
ADD COLUMN "voyageTeamMemberId" INTEGER,
ALTER COLUMN "projectIdeaId" SET NOT NULL;

-- AddForeignKey
ALTER TABLE "ProjectIdea" ADD CONSTRAINT "ProjectIdea_voyageTeamMemberId_fkey" FOREIGN KEY ("voyageTeamMemberId") REFERENCES "VoyageTeamMember"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ProjectIdeaVote" ADD CONSTRAINT "ProjectIdeaVote_voyageTeamMemberId_fkey" FOREIGN KEY ("voyageTeamMemberId") REFERENCES "VoyageTeamMember"("id") ON DELETE SET NULL ON UPDATE CASCADE;
14 changes: 7 additions & 7 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ model VoyageTeamMember {

model ProjectIdea {
id Int @id @default(autoincrement())
contributedBy VoyageTeamMember? @relation(fields: [userId], references: [id], onUpdate: Cascade, onDelete: SetNull)
userId Int?
contributedBy VoyageTeamMember? @relation(fields: [voyageTeamMemberId], references: [id], onUpdate: Cascade, onDelete: SetNull)
voyageTeamMemberId Int?
title String
description String
vision String
Expand All @@ -170,12 +170,12 @@ model ProjectIdea {

model ProjectIdeaVote {
id Int @id @default(autoincrement())
votedBy VoyageTeamMember? @relation(fields: [userId], references: [id], onUpdate: Cascade, onDelete: SetNull)
userId Int?
ProjectIdea ProjectIdea? @relation(fields: [projectIdeaId], references: [id], onDelete: Cascade)
projectIdeaId Int?
votedBy VoyageTeamMember? @relation(fields: [voyageTeamMemberId], references: [id], onUpdate: Cascade, onDelete: SetNull)
smurph7894 marked this conversation as resolved.
Show resolved Hide resolved
voyageTeamMemberId Int?
projectIdea ProjectIdea? @relation(fields: [projectIdeaId], references: [id],onDelete: Cascade)
projectIdeaId Int
createdAt DateTime @default(now()) @db.Timestamptz()
updatedAt DateTime @updatedAt
updatedAt DateTime @updatedAt
}

model TechStackCategory {
Expand Down
4 changes: 2 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Module } from "@nestjs/common";
import { PrismaModule } from "./prisma/prisma.module";
import { IdeationModule } from "./ideation/ideation.module";
import { IdeationsModule } from "./ideations/ideations.module";
import { TeamsModule } from "./teams/teams.module";
import { TechsModule } from "./techs/techs.module";
import { HealthCheckController } from "./HealthCheck/health-check.controller";
Expand All @@ -11,7 +11,7 @@ import { UsersModule } from "./users/users.module";
imports: [
UsersModule,
PrismaModule,
IdeationModule,
IdeationsModule,
TeamsModule,
TechsModule,
UsersModule,
Expand Down
1 change: 0 additions & 1 deletion src/ideation/dto/create-ideation.dto.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/ideation/dto/update-ideation.dto.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/ideation/entities/ideation.entity.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/ideation/ideation.controller.spec.ts

This file was deleted.

37 changes: 0 additions & 37 deletions src/ideation/ideation.controller.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/ideation/ideation.module.ts

This file was deleted.

73 changes: 0 additions & 73 deletions src/ideation/ideation.service.ts

This file was deleted.

13 changes: 13 additions & 0 deletions src/ideations/dto/create-ideation-vote.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsString} from 'class-validator';

export class CreateIdeationVoteDto {
@IsString()
@IsNotEmpty()
@ApiProperty()
userId: string;

@IsNotEmpty()
@ApiProperty()
projectIdeaId: number;
}
23 changes: 23 additions & 0 deletions src/ideations/dto/create-ideation.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsString, } from 'class-validator';


export class CreateIdeationDto {
@IsString()
@IsNotEmpty()
@ApiProperty()
userId: string;

@IsString()
@IsNotEmpty()
@ApiProperty()
title: string;

@IsString()
@ApiProperty()
description: string;

@IsString()
@ApiProperty()
vision: string;
}
23 changes: 23 additions & 0 deletions src/ideations/dto/update-ideation.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsString, } from 'class-validator';
import { PartialType } from "@nestjs/swagger";
import { CreateIdeationDto } from "./create-ideation.dto";

export class UpdateIdeationDto extends PartialType(CreateIdeationDto) {
@IsString()
@IsNotEmpty()
@ApiProperty()
userId: string;

@IsString()
@ApiProperty()
title: string;

@IsString()
@ApiProperty()
description: string;

@IsString()
@ApiProperty()
vision: string;
}
28 changes: 28 additions & 0 deletions src/ideations/entities/ideation.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ApiProperty } from "@nestjs/swagger";
import { ProjectIdea } from "@prisma/client";

export class Ideation implements ProjectIdea {
@ApiProperty()
id: number;

@ApiProperty()
voyageTeamMemberId: number;

@ApiProperty()
title: string;

@ApiProperty()
description: string;

@ApiProperty()
vision: string;

@ApiProperty()
createdAt: Date;

@ApiProperty()
updatedAt: Date;

@ApiProperty({type: [Number], required: false, nullable: true})
projectIdeaVotes: number[];
}
20 changes: 20 additions & 0 deletions src/ideations/ideations.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Test, TestingModule } from "@nestjs/testing";
import { IdeationsController } from "./ideations.controller";
import { IdeationsService } from "./ideations.service";

describe("IdeationsController", () => {
let controller: IdeationsController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [IdeationsController],
providers: [IdeationsService],
}).compile();

controller = module.get<IdeationsController>(IdeationsController);
});

it("should be defined", () => {
expect(controller).toBeDefined();
});
});
Loading
Loading