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

Refractor: update all form title reference #145

Merged
merged 8 commits into from
May 6, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Another example [here](https://co-pilot.dev/changelog)
- Remove teamMeetings from response for getSprintDatesByTeamId [#139](https://github.com/chingu-x/chingu-dashboard-be/pull/139)
- Updated response for route GET sprints/meetings/{meetingId} to include updatedAt for agendas [#140](https://github.com/chingu-x/chingu-dashboard-be/pull/140)
- Update test github actions workflow with timeout [#143](https://github.com/chingu-x/chingu-dashboard-be/pull/143)
- Refractor of all form title reference to use values from formTitle.ts [#145](https://github.com/chingu-x/chingu-dashboard-be/pull/145)
- Update/Add more form input types [#146](https://github.com/chingu-x/chingu-dashboard-be/pull/146)

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion prisma/seed/forms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const populateFormsAndResponses = async () => {
name: "meeting",
},
},
title: "Retrospective & Review",
title: FormTitles.sprintRetroAndReview,
questions: {
create: [
{
Expand Down
7 changes: 4 additions & 3 deletions prisma/seed/meetings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { getRandomDateDuringSprint, getSprintId } from "./utils";
import { prisma } from "./prisma-client";
import { FormTitles } from "../../src/global/constants/formTitles";

export const populateMeetings = async () => {
// connect teamMeetings and form id
Expand Down Expand Up @@ -50,7 +51,7 @@ export const populateMeetings = async () => {
//find question Ids from sprint planning form
const sprintPlanningForm = await prisma.form.findUnique({
where: {
title: "Sprint Planning",
title: FormTitles.sprintPlanning,
},
select: {
questions: true,
Expand All @@ -61,7 +62,7 @@ export const populateMeetings = async () => {
data: {
form: {
connect: {
title: "Sprint Planning",
title: FormTitles.sprintPlanning,
},
},
meeting: {
Expand Down Expand Up @@ -97,7 +98,7 @@ export const populateMeetings = async () => {
data: {
form: {
connect: {
title: "Retrospective & Review",
title: FormTitles.sprintRetroAndReview,
},
},
meeting: {
Expand Down
3 changes: 2 additions & 1 deletion prisma/seed/solo-project.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { FormTitles } from "../../src/global/constants/formTitles";
import { passedSampleFeedback } from "./data/text/solo-project-feedback";
import { prisma } from "./prisma-client";

Expand All @@ -18,7 +19,7 @@ export const populateSoloProjects = async () => {

const soloProjectForm = await prisma.form.findUnique({
where: {
title: "Solo Project Submission Form",
title: FormTitles.soloProjectSubmission,
},
select: {
id: true,
Expand Down
3 changes: 2 additions & 1 deletion prisma/seed/voyage-app.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { FormTitles } from "../../src/global/constants/formTitles";
import { prisma } from "./prisma-client";

export const populateVoyageApplications = async () => {
const users = await prisma.user.findMany({});

const voyageApplicationForm = await prisma.form.findUnique({
where: {
title: "Voyage Application Form",
title: FormTitles.voyageApplication,
},
select: {
id: true,
Expand Down
3 changes: 2 additions & 1 deletion src/sprints/sprints.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { FormsService } from "../forms/forms.service";
import { UpdateMeetingFormResponseDto } from "./dto/update-meeting-form-response.dto";
import { CreateCheckinFormDto } from "./dto/create-checkin-form.dto";
import { GlobalService } from "../global/global.service";
import { FormTitles } from "../global/constants/formTitles";

@Injectable()
export class SprintsService {
Expand Down Expand Up @@ -554,7 +555,7 @@ export class SprintsService {
this.globalServices.responseDtoToArray(createCheckinForm);

await this.globalServices.checkQuestionsInFormByTitle(
"Sprint Check-in",
FormTitles.sprintCheckin,
responsesArray,
);

Expand Down
10 changes: 5 additions & 5 deletions test/sprints.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ describe("Sprints Controller (e2e)", () => {
)
.set("Cookie", accessToken)
.send({
title: "Sprint Planning",
title: FormTitles.sprintPlanning,
description: "This is a meeting description.",
dateTime: "2024-03-01T23:11:20.271Z",
meetingLink: "samplelink.com/meeting1234",
Expand Down Expand Up @@ -322,11 +322,11 @@ describe("Sprints Controller (e2e)", () => {
it("- verify new sprint meeting found in database", async () => {
const meeting = await prisma.teamMeeting.findFirst({
where: {
title: "Sprint Planning",
title: FormTitles.sprintPlanning,
notes: "Notes for the meeting",
},
});
return expect(meeting.title).toEqual("Sprint Planning");
return expect(meeting.title).toEqual(FormTitles.sprintPlanning);
});

it("should return 409 if trying to create a meeting that already exists for sprint", async () => {
Expand All @@ -338,7 +338,7 @@ describe("Sprints Controller (e2e)", () => {
)
.set("Cookie", accessToken)
.send({
title: "Sprint Planning",
title: FormTitles.sprintPlanning,
description: "This is a meeting description.",
dateTime: "2024-03-01T23:11:20.271Z",
meetingLink: "samplelink.com/meeting1234",
Expand All @@ -356,7 +356,7 @@ describe("Sprints Controller (e2e)", () => {
)
.set("Cookie", accessToken)
.send({
title: "Sprint Planning",
title: FormTitles.sprintPlanning,
description: "This is a meeting description.",
dateTime: "2024-03-01T23:11:20.271Z",
meetingLink: "samplelink.com/meeting1234",
Expand Down
Loading