Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(PM-2540): added ai workflow id to default reviewer#36

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
hentrymartin wants to merge6 commits intodevelop
base:develop
Choose a base branch
Loading
frompm-2540
Draft
Show file tree
Hide file tree
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,66 @@
-- Add indexes to support faster `/v6/my-reviews` queries.

CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATESCHEMAIF NOT EXISTS skills;
CREATESCHEMAIF NOT EXISTS reviews;

CREATE EXTENSION IF NOT EXISTS fuzzystrmatch WITH SCHEMA skills;
CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA pg_catalog;
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA reviews;
CREATE EXTENSION IF NOT EXISTS"uuid-ossp" WITH SCHEMA skills;

CREATEINDEXIF NOT EXISTS"challenge_status_type_track_created_at_idx"
ON"Challenge" ("status","typeId","trackId","createdAt"DESC);

DROPINDEX IF EXISTS"challenge_name_idx";

CREATEINDEXIF NOT EXISTS"challenge_name_trgm_idx"
ON"Challenge" USING gin ("name"pg_catalog.gin_trgm_ops);

DO
$$
DECLARE
challenge_phase_schemaTEXT;
BEGIN
SELECTn.nspname
INTO challenge_phase_schema
FROM pg_class c
JOIN pg_namespace nONn.oid=c.relnamespace
WHEREc.relname='ChallengePhase'
ANDc.relkind='r'
LIMIT1;

IF challenge_phase_schema ISNULL THEN
RETURN;
END IF;

IF NOT EXISTS (
SELECT1
FROM pg_class idx
JOIN pg_namespace nsONns.oid=idx.relnamespace
WHEREidx.relname='challenge_phase_order_idx'
ANDns.nspname= challenge_phase_schema
)
AND EXISTS (
SELECT1
FROM pg_class idx
JOIN pg_namespace nsONns.oid=idx.relnamespace
WHEREidx.relname='challenge_phase_challenge_open_end_idx'
ANDns.nspname= challenge_phase_schema
AND pg_get_indexdef(idx.oid)LIKE'%("challengeId", "isOpen", "scheduledEndDate", "actualEndDate", name)%'
)
THEN
EXECUTE format(
'ALTER INDEX %I.%I RENAME TO %I',
challenge_phase_schema,
'challenge_phase_challenge_open_end_idx',
'challenge_phase_order_idx'
);
END IF;
END
$$ LANGUAGE plpgsql;

CREATEINDEXIF NOT EXISTS"challenge_phase_challenge_open_end_idx"
ON"ChallengePhase" ("challengeId","isOpen","scheduledEndDate","actualEndDate");

CREATEINDEXIF NOT EXISTS"challenge_name_trgm_idx"
ON"Challenge"
USING gin ("name"pg_catalog.gin_trgm_ops);
CREATEINDEXIF NOT EXISTS"challenge_phase_order_idx"
ON"ChallengePhase" ("challengeId","isOpen","scheduledEndDate","actualEndDate","name");
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
/*
Warnings:
- You are about to drop the column `isAIReviewer` on the `DefaultChallengeReviewer` table. All the data in the column will be lost.
*/
-- AlterTable
ALTERTABLE"DefaultChallengeReviewer" DROP COLUMN"isAIReviewer",
ADD COLUMN"aiWorkflowId"VARCHAR(14);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
-- DropIndex
DROPINDEX"challenges"."challenge_name_trgm_idx";

-- DropIndex
DROPINDEX"challenges"."challenge_phase_order_idx";

-- CreateIndex
CREATEINDEX "challenge_name_trgm_idx"ON"Challenge" USING GIN ("name"pg_catalog.gin_trgm_ops);
2 changes: 1 addition & 1 deletionprisma/schema.prisma
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -645,7 +645,7 @@ model DefaultChallengeReviewer {
baseCoefficient Float?
incrementalCoefficient Float?
opportunityType ReviewOpportunityTypeEnum?
isAIReviewerBoolean
aiWorkflowIdString? @db.VarChar(14)
shouldOpenOpportunity Boolean @default(true)

// Relations
Expand Down
9 changes: 1 addition & 8 deletionssrc/services/ChallengeService.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -280,7 +280,6 @@ async function getDefaultReviewers(currentUser, criteria) {
incrementalCoefficient: r.incrementalCoefficient,
type: r.opportunityType,
aiWorkflowId: r.aiWorkflowId,
isAIReviewer: r.isAIReviewer,
shouldOpenOpportunity: _.isBoolean(r.shouldOpenOpportunity) ? r.shouldOpenOpportunity : true,
}));
}
Expand All@@ -302,7 +301,6 @@ async function setDefaultReviewers(currentUser, data) {
Joi.object().keys({
scorecardId: Joi.string().required(),
isMemberReview: Joi.boolean().required(),
isAIReviewer: Joi.boolean().default(false),
shouldOpenOpportunity: Joi.boolean().default(true),
memberReviewerCount: Joi.when("isMemberReview", {
is: true,
Expand DownExpand Up@@ -383,7 +381,7 @@ async function setDefaultReviewers(currentUser, data) {
timelineTemplateId: _.isNil(value.timelineTemplateId) ? null : value.timelineTemplateId,
scorecardId: String(r.scorecardId),
isMemberReview: !!r.isMemberReview,
isAIReviewer: !!r.isAIReviewer,
aiWorkflowId:_.isNil(r.aiWorkflowId) ? null : r.aiWorkflowId,
memberReviewerCount: _.isNil(r.memberReviewerCount)
? null
: Number(r.memberReviewerCount),
Expand All@@ -394,7 +392,6 @@ async function setDefaultReviewers(currentUser, data) {
? null
: Number(r.incrementalCoefficient),
opportunityType: r.type ? _.toUpper(r.type) : null,
aiWorkflowId: r.aiWorkflowId,
shouldOpenOpportunity: _.isNil(r.shouldOpenOpportunity)
? true
: !!r.shouldOpenOpportunity,
Expand DownExpand Up@@ -1492,7 +1489,6 @@ async function createChallenge(currentUser, challenge, userToken) {
incrementalCoefficient: r.incrementalCoefficient,
type: r.opportunityType,
aiWorkflowId: r.aiWorkflowId,
isAIReviewer: r.isAIReviewer ?? false,
shouldOpenOpportunity: _.isBoolean(r.shouldOpenOpportunity)
? r.shouldOpenOpportunity
: true,
Expand DownExpand Up@@ -1660,7 +1656,6 @@ createChallenge.schema = {
Joi.object().keys({
scorecardId: Joi.string().required(),
isMemberReview: Joi.boolean().required(),
isAIReviewer: Joi.boolean().default(false),
shouldOpenOpportunity: Joi.boolean().default(true),
memberReviewerCount: Joi.when("isMemberReview", {
is: true,
Expand DownExpand Up@@ -2855,7 +2850,6 @@ updateChallenge.schema = {
Joi.object().keys({
scorecardId: Joi.string().required(),
isMemberReview: Joi.boolean().required(),
isAIReviewer: Joi.boolean().default(false),
shouldOpenOpportunity: Joi.boolean().default(true),
memberReviewerCount: Joi.when("isMemberReview", {
is: true,
Expand DownExpand Up@@ -3335,7 +3329,6 @@ function sanitizeChallenge(challenge) {
_.pick(rv, [
"scorecardId",
"isMemberReview",
"isAIReviewer",
"memberReviewerCount",
"phaseId",
"fixedAmount",
Expand Down
19 changes: 14 additions & 5 deletionssrc/services/DefaultChallengeReviewerService.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -262,8 +262,9 @@ function normalizePayload(data = {}, isPartial = false) {
} else if (!isPartial && _.isNil(data.opportunityType)) {
normalized.opportunityType = null;
}
if (shouldAssign(data.isAIReviewer)) {
normalized.isAIReviewer = data.isAIReviewer;

if (shouldAssign(data.aiWorkflowId)) {
normalized.aiWorkflowId = data.aiWorkflowId;
}
if (shouldAssign(data.shouldOpenOpportunity)) {
normalized.shouldOpenOpportunity = data.shouldOpenOpportunity;
Expand DownExpand Up@@ -338,7 +339,11 @@ createDefaultChallengeReviewer.schema = {
baseCoefficient: Joi.number().min(0).max(1).allow(null),
incrementalCoefficient: Joi.number().min(0).max(1).allow(null),
opportunityType: Joi.string().valid(..._.values(ReviewOpportunityTypeEnum)).insensitive(),
isAIReviewer: Joi.boolean().required(),
aiWorkflowId: Joi.when("isMemberReview", {
is: false,
then: Joi.string().required(),
otherwise: Joi.valid(null),
}),
shouldOpenOpportunity: Joi.boolean().required(),
})
.required(),
Expand DownExpand Up@@ -417,7 +422,11 @@ fullyUpdateDefaultChallengeReviewer.schema = {
baseCoefficient: Joi.number().min(0).max(1).allow(null),
incrementalCoefficient: Joi.number().min(0).max(1).allow(null),
opportunityType: Joi.string().valid(..._.values(ReviewOpportunityTypeEnum)).insensitive(),
isAIReviewer: Joi.boolean().required(),
aiWorkflowId: Joi.when("isMemberReview", {
is: false,
then: Joi.string().required(),
otherwise: Joi.valid(null),
}),
shouldOpenOpportunity: Joi.boolean().required(),
})
.required(),
Expand DownExpand Up@@ -516,7 +525,7 @@ partiallyUpdateDefaultChallengeReviewer.schema = {
.valid(..._.values(ReviewOpportunityTypeEnum))
.insensitive()
.allow(null),
isAIReviewer: Joi.boolean(),
aiWorkflowId: Joi.string(),
shouldOpenOpportunity: Joi.boolean(),
})
.required(),
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp