Skip to content

Commit 1b27c93

Browse files
authored
Merge pull request #59 from topcoder-platform/PLAT-3358
feat: update create legacy challenge input
2 parents e333def + bdad93a commit 1b27c93

File tree

4 files changed

+31
-32
lines changed

4 files changed

+31
-32
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"@aws-sdk/util-utf8-node": "^3.259.0",
2424
"@grpc/grpc-js": "^1.7.1",
2525
"@opensearch-project/opensearch": "^2.2.0",
26-
"@topcoder-framework/domain-acl": "^0.19.0",
27-
"@topcoder-framework/lib-common": "^0.19.0",
28-
"topcoder-interface": "github:topcoder-platform/plat-interface-definition#v0.0.56",
26+
"@topcoder-framework/domain-acl": "^0.21.0",
27+
"@topcoder-framework/lib-common": "^0.21.0",
28+
"topcoder-interface": "github:topcoder-platform/plat-interface-definition#v0.0.57-beta-1",
2929
"@types/uuid": "^9.0.1",
3030
"aws-sdk": "^2.1339.0",
3131
"axios": "^1.2.2",
@@ -55,4 +55,4 @@
5555
"ts-proto": "^1.126.1",
5656
"typescript": "^4.9.4"
5757
}
58-
}
58+
}

src/domain/Challenge.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
7575
trackId: string,
7676
typeId: string,
7777
tags: string[],
78-
metadata: Metadata = new Metadata()
78+
metadata: Metadata = new Metadata(),
79+
id: string = "",
7980
) {
8081
let legacyChallengeId: number | null = null;
8182

@@ -102,7 +103,7 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
102103
if (status === ChallengeStatuses.Draft) {
103104
try {
104105
// prettier-ignore
105-
const legacyChallengeCreateInput = LegacyCreateChallengeInput.fromPartial(await legacyMapper.mapChallengeDraftUpdateInput(input));
106+
const legacyChallengeCreateInput = LegacyCreateChallengeInput.fromPartial(await legacyMapper.mapChallengeDraftUpdateInput(input, id));
106107
// prettier-ignore
107108
const legacyChallengeCreateResponse = await legacyChallengeDomain.create(legacyChallengeCreateInput, metadata);
108109

@@ -242,7 +243,7 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
242243
};
243244

244245
// prettier-ignore
245-
const { legacy, legacyChallengeId, phases } = await this.createLegacyChallenge(createChallengeInput, input.status, challenge!.trackId, challenge!.typeId, challenge!.tags, metadata);
246+
const { legacy, legacyChallengeId, phases } = await this.createLegacyChallenge(createChallengeInput, input.status, challenge!.trackId, challenge!.typeId, challenge!.tags, metadata, challenge.id);
246247

247248
input.legacy = legacy;
248249
input.phaseUpdate = { phases };

src/util/LegacyMapper.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import DateUtil from "./DateUtil";
2828
class LegacyMapper {
2929
// To be used on challenge:update calls that change state from New -> Draft
3030
public mapChallengeDraftUpdateInput = async (
31-
input: CreateChallengeInput
31+
input: CreateChallengeInput,
32+
id: string
3233
): Promise<LegacyChallengeCreateInput> => {
3334
const prizeSets = this.mapPrizeSets(input.prizeSets);
3435
const projectInfo = this.mapProjectInfo(input, prizeSets, input.legacy?.subTrack!);
@@ -51,6 +52,7 @@ class LegacyMapper {
5152
reviewType: input.legacy?.reviewType ?? "INTERNAL",
5253
confidentialityType: input.legacy?.confidentialityType ?? "public",
5354
projectInfo,
55+
id
5456
};
5557
};
5658

yarn.lock

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -946,35 +946,35 @@
946946
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
947947
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==
948948

949-
"@topcoder-framework/client-relational@^0.19.0":
950-
version "0.19.0"
951-
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/client-relational/-/client-relational-0.19.0.tgz#035a7a8d14951a60d6d4003da4f2ea53071ca81c"
952-
integrity sha512-2kMsaoC0wU6fQeKTMLV8FNOzDcDgeYLtNtsLOU5xIJcncWvafBvi0mHWLLqHWXQL9AXVXYC+A0TIxU/ezD57Xw==
949+
"@topcoder-framework/client-relational@^0.21.0":
950+
version "0.21.0"
951+
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/client-relational/-/client-relational-0.21.0.tgz#93a4389b0a9f4416354d47716dafd973628fab99"
952+
integrity sha512-8wl6t0Ro/1AosmNTBW54/ySh40tE+lk/MQIXNIRIUdmvX+kt4B6ukFwdvR0qPcOAzqi3o59v08sVPLiPukhYFw==
953953
dependencies:
954954
"@grpc/grpc-js" "^1.8.0"
955-
"@topcoder-framework/lib-common" "^0.19.0"
956-
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.56-beta-2"
955+
"@topcoder-framework/lib-common" "^0.21.0"
956+
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.57-beta-1"
957957
tslib "^2.4.1"
958958

959-
"@topcoder-framework/domain-acl@^0.19.0":
960-
version "0.19.0"
961-
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/domain-acl/-/domain-acl-0.19.0.tgz#ee08dfb5c02583c80d4c61d50fe762dd6c6ad462"
962-
integrity sha512-uJLzP8pmCfc7m5paGB00S2Qa6n7W+PR9EPf83S9DD3mCPt7Vs4goJj/jVCGkE0raMdgsbHCZ1Hncf+41axDKxg==
959+
"@topcoder-framework/domain-acl@^0.21.0":
960+
version "0.21.0"
961+
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/domain-acl/-/domain-acl-0.21.0.tgz#849fb40a2517b5647ff5d910ae872b010c1997c1"
962+
integrity sha512-jN6jjywWnsIjE2GN1fdsitsc/inJP4DuXtWW+c9o/Gt4UJUTlx3Thss7aC/GTenV0wQtLaTgRldxSMdUvBadiQ==
963963
dependencies:
964964
"@grpc/grpc-js" "^1.8.7"
965-
"@topcoder-framework/client-relational" "^0.19.0"
966-
"@topcoder-framework/lib-common" "^0.19.0"
967-
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.56-beta-2"
965+
"@topcoder-framework/client-relational" "^0.21.0"
966+
"@topcoder-framework/lib-common" "^0.21.0"
967+
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.57-beta-1"
968968
tslib "^2.4.1"
969969

970-
"@topcoder-framework/lib-common@^0.19.0":
971-
version "0.19.0"
972-
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/lib-common/-/lib-common-0.19.0.tgz#3a4af330a436c433800100376c20f3f3c3ea51eb"
973-
integrity sha512-//o5yJ8BMdw8I4oqw2sutTbxF5MwkO5Vzz3la1Q9uziL5Gj6n727PbfN/y1VCeZBpRDrdT2g9sIkdwC5FKyBdg==
970+
"@topcoder-framework/lib-common@^0.21.0":
971+
version "0.21.0"
972+
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/lib-common/-/lib-common-0.21.0.tgz#01c48a9421b0eb02b86c3737de4745ec53c3c8f4"
973+
integrity sha512-yLHWy5Q3PP6fS6rwwQAmpv54C8LuGKMns+CT7DUQcRX1+OJN4ozINQ5sezjzGx22GnODxsHbk5PbjMJpG/Pc+g==
974974
dependencies:
975975
"@grpc/grpc-js" "^1.8.0"
976976
rimraf "^3.0.2"
977-
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.56-beta-2"
977+
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.57-beta-1"
978978
tslib "^2.4.1"
979979

980980
"@tsconfig/node10@^1.0.7":
@@ -2698,13 +2698,9 @@ topcoder-bus-api-wrapper@topcoder-platform/tc-bus-api-wrapper.git:
26982698
superagent "^3.8.3"
26992699
tc-core-library-js appirio-tech/tc-core-library-js.git#v2.6.4
27002700

2701-
"topcoder-interface@github:topcoder-platform/plat-interface-definition#v0.0.56":
2701+
"topcoder-interface@github:topcoder-platform/plat-interface-definition#v0.0.57-beta-1":
27022702
version "1.0.0"
2703-
resolved "https://codeload.github.com/topcoder-platform/plat-interface-definition/tar.gz/ba65ef794552c35ffa86346ca29110531833bcc0"
2704-
2705-
"topcoder-interface@github:topcoder-platform/plat-interface-definition#v0.0.56-beta-2":
2706-
version "1.0.0"
2707-
resolved "https://codeload.github.com/topcoder-platform/plat-interface-definition/tar.gz/dd63b3f8aee86ab64dcfc04e84f8adfd633bd336"
2703+
resolved "https://codeload.github.com/topcoder-platform/plat-interface-definition/tar.gz/af7812437904275e62f85182515764ef218ff75f"
27082704

27092705
topo@3.x.x:
27102706
version "3.0.3"

0 commit comments

Comments
 (0)