Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
-- -- AlterTable
-- ALTER TABLE "aiWorkflow" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "aiWorkflowRunItem" ALTER COLUMN "createdBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "aiWorkflowRunItemComment" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "appeal" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "appealResponse" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "challengeResult" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "contactRequest" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "llmModel" ALTER COLUMN "createdBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "llmProvider" ALTER COLUMN "createdBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "resourceSubmission" ALTER COLUMN "createdBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "review" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "reviewApplication" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "reviewItem" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "reviewItemComment" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "reviewOpportunity" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "reviewSummation" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "scorecard" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "scorecardGroup" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "scorecardQuestion" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "scorecardSection" ALTER COLUMN "createdBy" DROP NOT NULL,
-- ALTER COLUMN "updatedBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "submission" ALTER COLUMN "createdBy" DROP NOT NULL;

-- -- AlterTable
-- ALTER TABLE "upload" ALTER COLUMN "createdBy" DROP NOT NULL;
80 changes: 40 additions & 40 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ model scorecard {
minScore Float
maxScore Float
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

scorecardGroups scorecardGroup[]
reviews review[]
Expand Down Expand Up @@ -75,9 +75,9 @@ model scorecardGroup {
weight Float
sortOrder Int
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

scorecard scorecard @relation(fields: [scorecardId], references: [id], onDelete: Cascade)
sections scorecardSection[]
Expand All @@ -95,9 +95,9 @@ model scorecardSection {
weight Float
sortOrder Int
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

group scorecardGroup @relation(fields: [scorecardGroupId], references: [id], onDelete: Cascade)
questions scorecardQuestion[]
Expand Down Expand Up @@ -125,9 +125,9 @@ model scorecardQuestion {
requiresUpload Boolean
sortOrder Int
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

scaleMin Int? // Minimum value for scale (used when type is SCALE)
scaleMax Int? // Maximum value for scale (used when type is SCALE)
Expand Down Expand Up @@ -167,9 +167,9 @@ model review {
status ReviewStatus?
reviewDate DateTime?
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

scorecard scorecard @relation(fields: [scorecardId], references: [id], onDelete: Cascade)
submission submission? @relation(fields: [submissionId], references: [id], onDelete: Cascade)
Expand All @@ -193,9 +193,9 @@ model reviewItem {
finalAnswer String?
managerComment String?
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

review review @relation(fields: [reviewId], references: [id], onDelete: Cascade)
reviewItemComments reviewItemComment[]
Expand All @@ -214,9 +214,9 @@ model reviewItemComment {
type ReviewItemCommentType
sortOrder Int @default(0)
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

reviewItem reviewItem @relation(fields: [reviewItemId], references: [id], onDelete: Cascade)
appeal appeal?
Expand Down Expand Up @@ -249,9 +249,9 @@ model appeal {
reviewItemCommentId String @unique // Ensure one-to-one relationship
content String
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

reviewItemComment reviewItemComment @relation(fields: [reviewItemCommentId], references: [id], onDelete: Cascade) // Define fields and references here
appealResponse appealResponse?
Expand All @@ -269,9 +269,9 @@ model appealResponse {
content String
success Boolean
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

appeal appeal @relation(fields: [appealId], references: [id], onDelete: Cascade)

Expand All @@ -297,9 +297,9 @@ model challengeResult {
ratingOrder Int?

createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

@@id([challengeId, userId])
@@index([challengeId]) // Index for filtering by challenge
Expand All @@ -313,9 +313,9 @@ model contactRequest {
challengeId String // Associated challenge
message String // Markdown content
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

@@index([id]) // Index for direct ID lookups
@@index([resourceId]) // Index for filtering by resource (requester)
Expand Down Expand Up @@ -344,9 +344,9 @@ model reviewSummation {
isFinal Boolean?
reviewedDate DateTime?
createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

submission submission @relation(fields: [submissionId], references: [id], onDelete: Cascade)

Expand Down Expand Up @@ -383,7 +383,7 @@ model submission {
submittedDate DateTime?

createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime? @updatedAt
updatedBy String?

Expand Down Expand Up @@ -449,9 +449,9 @@ model reviewOpportunity {
applications reviewApplication[]

createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

@@unique([challengeId, type])
@@index([id]) // Index for direct ID lookups
Expand All @@ -469,9 +469,9 @@ model reviewApplication {
opportunity reviewOpportunity @relation(fields: [opportunityId], references: [id], onDelete: Cascade)

createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime @updatedAt
updatedBy String
updatedBy String?

@@unique([opportunityId, userId, role])
@@index([id]) // Index for direct ID lookups
Expand Down Expand Up @@ -521,7 +521,7 @@ model upload {
projectPhaseId String?

createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime? @updatedAt
updatedBy String?

Expand All @@ -538,7 +538,7 @@ model resourceSubmission {
legacySubmissionId String?

createdAt DateTime @default(now())
createdBy String
createdBy String?
updatedAt DateTime? @updatedAt
updatedBy String?

Expand All @@ -561,7 +561,7 @@ model llmProvider {
id String @id @default(dbgenerated("nanoid()")) @db.VarChar(14)
name String @unique @db.VarChar
createdAt DateTime @db.Timestamp(3)
createdBy String @db.Text
createdBy String? @db.Text

models llmModel[]
}
Expand All @@ -574,7 +574,7 @@ model llmModel {
icon String? @db.VarChar
url String? @db.VarChar
createdAt DateTime @default(now()) @db.Timestamp(3)
createdBy String @db.Text
createdBy String? @db.Text

provider llmProvider @relation(fields: [providerId], references: [id])
workflows aiWorkflow[]
Expand All @@ -590,9 +590,9 @@ model aiWorkflow {
gitOwner String @db.VarChar
scorecardId String @db.VarChar(14)
createdAt DateTime @default(now()) @db.Timestamp(3)
createdBy String @db.Text
updatedAt DateTime @db.Timestamp(3)
updatedBy String @db.Text
createdBy String? @db.Text
updatedAt DateTime @updatedAt
updatedBy String? @db.Text

llm llmModel @relation(fields: [llmId], references: [id])
scorecard scorecard @relation(fields: [scorecardId], references: [id])
Expand Down Expand Up @@ -623,7 +623,7 @@ model aiWorkflowRunItem {
downVotes Int @default(0)
questionScore Float? @db.DoublePrecision
createdAt DateTime @db.Timestamp(3)
createdBy String @db.Text
createdBy String? @db.Text

run aiWorkflowRun @relation(fields: [workflowRunId], references: [id])
question scorecardQuestion @relation(fields: [scorecardQuestionId], references: [id])
Expand All @@ -637,9 +637,9 @@ model aiWorkflowRunItemComment {
content String @db.Text
parentId String? @db.VarChar(14)
createdAt DateTime @default(now()) @db.Timestamp(3)
createdBy String @db.Text
updatedAt DateTime @db.Timestamp(3)
updatedBy String @db.Text
createdBy String? @db.Text
updatedAt DateTime @updatedAt
updatedBy String? @db.Text

item aiWorkflowRunItem @relation(fields: [workflowRunItemId], references: [id])
parent aiWorkflowRunItemComment? @relation("CommentHierarchy", fields: [parentId], references: [id])
Expand Down
4 changes: 0 additions & 4 deletions src/api/ai-workflow/ai-workflow.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ export class AiWorkflowService {
name,
scorecardId,
llmId,
// TODO: This has to be removed once the prisma middleware is implemented
createdBy: '',
updatedAt: new Date(),
updatedBy: '',
},
})
.catch((e) => {
Expand Down
5 changes: 2 additions & 3 deletions src/api/appeal/appeal.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
AppealResponseDto,
AppealResponseRequestDto,
AppealResponseResponseDto,
mapAppealRequestToDto,
mapAppealResponseRequestToDto,
} from 'src/dto/appeal.dto';
import { PrismaService } from '../../shared/modules/global/prisma.service';
Expand Down Expand Up @@ -103,7 +102,7 @@ export class AppealController {
await this.challengeApiService.validateAppealSubmission(challengeId);

const data = await this.prisma.appeal.create({
data: mapAppealRequestToDto(body),
data: { ...body },
});
this.logger.log(`Appeal created with ID: ${data.id}`);
return data as AppealResponseDto;
Expand Down Expand Up @@ -156,7 +155,7 @@ export class AppealController {
try {
const data = await this.prisma.appeal.update({
where: { id: appealId },
data: mapAppealRequestToDto(body),
data: { ...body },
});
this.logger.log(`Appeal updated successfully: ${appealId}`);
return data as AppealResponseDto;
Expand Down
6 changes: 4 additions & 2 deletions src/api/contact/contactRequests.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { LoggerService } from 'src/shared/modules/global/logger.service';
import {
ContactRequestDto,
ContactRequestResponseDto,
mapContactRequestToDto,
} from 'src/dto/contactRequest.dto';
import { JwtUser } from 'src/shared/modules/global/jwt.service';
import {
Expand Down Expand Up @@ -57,7 +56,10 @@ export class ContactRequestsService {

// Persist contact request
const data = await this.prisma.contactRequest.create({
data: mapContactRequestToDto(body, requesterResource.id),
data: {
...body,
resourceId: requesterResource.id,
},
});

// Fire email notification to managers/copilots for the challenge
Expand Down
Loading