- Notifications
You must be signed in to change notification settings - Fork6
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
base:develop
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
df1f21677cd473df0ad7a5b0163734e998f1b00196File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,66 @@ | ||
| -- Add indexes to support faster `/v6/my-reviews` queries. | ||
| CREATESCHEMAIF NOT EXISTS skills; | ||
| CREATESCHEMAIF NOT EXISTS reviews; | ||
| CREATE EXTENSION IF NOT EXISTS fuzzystrmatch WITH SCHEMA skills; | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA pg_catalog; | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA reviews; | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| CREATE EXTENSION IF NOT EXISTS"uuid-ossp" WITH SCHEMA skills; | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| 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)%' | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| ) | ||
| 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_phase_order_idx" | ||
| ON"ChallengePhase" ("challengeId","isOpen","scheduledEndDate","actualEndDate","name"); | ||
| Original file line number | Diff line number | Diff 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", | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| ADD COLUMN"aiWorkflowId"VARCHAR(14); | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| Original file line number | Diff line number | Diff 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); | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -645,7 +645,7 @@ model DefaultChallengeReviewer { | ||
| baseCoefficient Float? | ||
| incrementalCoefficient Float? | ||
| opportunityType ReviewOpportunityTypeEnum? | ||
| aiWorkflowIdString? @db.VarChar(14) | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| shouldOpenOpportunity Boolean @default(true) | ||
| // Relations | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -262,8 +262,9 @@ function normalizePayload(data = {}, isPartial = false) { | ||
| } else if (!isPartial && _.isNil(data.opportunityType)) { | ||
| normalized.opportunityType = null; | ||
| } | ||
| if (shouldAssign(data.aiWorkflowId)) { | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| normalized.aiWorkflowId = data.aiWorkflowId; | ||
| } | ||
| if (shouldAssign(data.shouldOpenOpportunity)) { | ||
| normalized.shouldOpenOpportunity = data.shouldOpenOpportunity; | ||
| @@ -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(), | ||
| aiWorkflowId: Joi.when("isMemberReview", { | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| is: false, | ||
| then: Joi.string().required(), | ||
| otherwise: Joi.valid(null), | ||
| }), | ||
| shouldOpenOpportunity: Joi.boolean().required(), | ||
| }) | ||
| .required(), | ||
| @@ -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(), | ||
| aiWorkflowId: Joi.when("isMemberReview", { | ||
| is: false, | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| then: Joi.string().required(), | ||
| otherwise: Joi.valid(null), | ||
| }), | ||
| shouldOpenOpportunity: Joi.boolean().required(), | ||
| }) | ||
| .required(), | ||
| @@ -516,7 +525,7 @@ partiallyUpdateDefaultChallengeReviewer.schema = { | ||
| .valid(..._.values(ReviewOpportunityTypeEnum)) | ||
| .insensitive() | ||
| .allow(null), | ||
| aiWorkflowId: Joi.string(), | ||
hentrymartin marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| shouldOpenOpportunity: Joi.boolean(), | ||
| }) | ||
| .required(), | ||