Skip to content

Plat 3368 #60

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

Merged
merged 4 commits into from
Sep 26, 2023
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"@aws-sdk/util-utf8-node": "^3.259.0",
"@grpc/grpc-js": "^1.7.1",
"@opensearch-project/opensearch": "^2.2.0",
"@topcoder-framework/domain-acl": "^0.21.0",
"@topcoder-framework/lib-common": "^0.21.0",
"topcoder-interface": "github:topcoder-platform/plat-interface-definition#v0.0.57-beta-1",
"@topcoder-framework/domain-acl": "^0.22.0",
"@topcoder-framework/lib-common": "^0.22.0",
"topcoder-interface": "github:topcoder-platform/plat-interface-definition#v0.0.58-beta-1",
"@types/uuid": "^9.0.1",
"aws-sdk": "^2.1339.0",
"axios": "^1.2.2",
Expand Down
1 change: 1 addition & 0 deletions src/domain/Challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
totalPrizesInCents,
} : undefined,
legacyId: legacyId != null ? legacyId : undefined,
constraints: input.constraints != null ? input.constraints : undefined,
},
metadata
);
Expand Down
122 changes: 122 additions & 0 deletions src/models/domain-layer/challenge/challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface Challenge {
created: number;
updated?: number | undefined;
overview?: Challenge_Overview;
constraints?: Challenge_Constraint | undefined;
}

export interface Challenge_Legacy {
Expand Down Expand Up @@ -136,6 +137,10 @@ export interface Challenge_Overview {
totalPrizes?: number | undefined;
}

export interface Challenge_Constraint {
allowedRegistrants: string[];
}

export interface ChallengeList {
items: Challenge[];
}
Expand Down Expand Up @@ -164,6 +169,7 @@ export interface CreateChallengeInput {
attachments: string[];
groups: string[];
discussions: Challenge_Discussion[];
constraints?: Challenge_Constraint | undefined;
}

export interface UpdateChallengeInput {
Expand Down Expand Up @@ -197,6 +203,7 @@ export interface UpdateChallengeInput_UpdateInput {
endDate?: string | undefined;
status?: string | undefined;
overview?: Challenge_Overview | undefined;
constraints?: Challenge_Constraint | undefined;
}

export interface UpdateChallengeInput_UpdateInput_WinnerUpdate {
Expand Down Expand Up @@ -322,6 +329,7 @@ function createBaseChallenge(): Challenge {
created: 0,
updated: undefined,
overview: undefined,
constraints: undefined,
};
}

Expand Down Expand Up @@ -420,6 +428,9 @@ export const Challenge = {
if (message.overview !== undefined) {
Challenge_Overview.encode(message.overview, writer.uint32(250).fork()).ldelim();
}
if (message.constraints !== undefined) {
Challenge_Constraint.encode(message.constraints, writer.uint32(258).fork()).ldelim();
}
return writer;
},

Expand Down Expand Up @@ -647,6 +658,13 @@ export const Challenge = {

message.overview = Challenge_Overview.decode(reader, reader.uint32());
continue;
case 32:
if (tag !== 258) {
break;
}

message.constraints = Challenge_Constraint.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
Expand Down Expand Up @@ -693,6 +711,7 @@ export const Challenge = {
created: isSet(object.created) ? Number(object.created) : 0,
updated: isSet(object.updated) ? Number(object.updated) : undefined,
overview: isSet(object.overview) ? Challenge_Overview.fromJSON(object.overview) : undefined,
constraints: isSet(object.constraints) ? Challenge_Constraint.fromJSON(object.constraints) : undefined,
};
},

Expand Down Expand Up @@ -771,6 +790,8 @@ export const Challenge = {
message.updated !== undefined && (obj.updated = Math.round(message.updated));
message.overview !== undefined &&
(obj.overview = message.overview ? Challenge_Overview.toJSON(message.overview) : undefined);
message.constraints !== undefined &&
(obj.constraints = message.constraints ? Challenge_Constraint.toJSON(message.constraints) : undefined);
return obj;
},

Expand Down Expand Up @@ -819,6 +840,9 @@ export const Challenge = {
message.overview = (object.overview !== undefined && object.overview !== null)
? Challenge_Overview.fromPartial(object.overview)
: undefined;
message.constraints = (object.constraints !== undefined && object.constraints !== null)
? Challenge_Constraint.fromPartial(object.constraints)
: undefined;
return message;
},
};
Expand Down Expand Up @@ -2142,6 +2166,70 @@ export const Challenge_Overview = {
},
};

function createBaseChallenge_Constraint(): Challenge_Constraint {
return { allowedRegistrants: [] };
}

export const Challenge_Constraint = {
encode(message: Challenge_Constraint, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.allowedRegistrants) {
writer.uint32(10).string(v!);
}
return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): Challenge_Constraint {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseChallenge_Constraint();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}

message.allowedRegistrants.push(reader.string());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},

fromJSON(object: any): Challenge_Constraint {
return {
allowedRegistrants: Array.isArray(object?.allowedRegistrants)
? object.allowedRegistrants.map((e: any) => String(e))
: [],
};
},

toJSON(message: Challenge_Constraint): unknown {
const obj: any = {};
if (message.allowedRegistrants) {
obj.allowedRegistrants = message.allowedRegistrants.map((e) => e);
} else {
obj.allowedRegistrants = [];
}
return obj;
},

create<I extends Exact<DeepPartial<Challenge_Constraint>, I>>(base?: I): Challenge_Constraint {
return Challenge_Constraint.fromPartial(base ?? {});
},

fromPartial<I extends Exact<DeepPartial<Challenge_Constraint>, I>>(object: I): Challenge_Constraint {
const message = createBaseChallenge_Constraint();
message.allowedRegistrants = object.allowedRegistrants?.map((e) => e) || [];
return message;
},
};

function createBaseChallengeList(): ChallengeList {
return { items: [] };
}
Expand Down Expand Up @@ -2227,6 +2315,7 @@ function createBaseCreateChallengeInput(): CreateChallengeInput {
attachments: [],
groups: [],
discussions: [],
constraints: undefined,
};
}

Expand Down Expand Up @@ -2301,6 +2390,9 @@ export const CreateChallengeInput = {
for (const v of message.discussions) {
Challenge_Discussion.encode(v!, writer.uint32(186).fork()).ldelim();
}
if (message.constraints !== undefined) {
Challenge_Constraint.encode(message.constraints, writer.uint32(194).fork()).ldelim();
}
return writer;
},

Expand Down Expand Up @@ -2472,6 +2564,13 @@ export const CreateChallengeInput = {

message.discussions.push(Challenge_Discussion.decode(reader, reader.uint32()));
continue;
case 24:
if (tag !== 194) {
break;
}

message.constraints = Challenge_Constraint.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
Expand Down Expand Up @@ -2510,6 +2609,7 @@ export const CreateChallengeInput = {
discussions: Array.isArray(object?.discussions)
? object.discussions.map((e: any) => Challenge_Discussion.fromJSON(e))
: [],
constraints: isSet(object.constraints) ? Challenge_Constraint.fromJSON(object.constraints) : undefined,
};
},

Expand Down Expand Up @@ -2575,6 +2675,8 @@ export const CreateChallengeInput = {
} else {
obj.discussions = [];
}
message.constraints !== undefined &&
(obj.constraints = message.constraints ? Challenge_Constraint.toJSON(message.constraints) : undefined);
return obj;
},

Expand Down Expand Up @@ -2613,6 +2715,9 @@ export const CreateChallengeInput = {
message.attachments = object.attachments?.map((e) => e) || [];
message.groups = object.groups?.map((e) => e) || [];
message.discussions = object.discussions?.map((e) => Challenge_Discussion.fromPartial(e)) || [];
message.constraints = (object.constraints !== undefined && object.constraints !== null)
? Challenge_Constraint.fromPartial(object.constraints)
: undefined;
return message;
},
};
Expand Down Expand Up @@ -2728,6 +2833,7 @@ function createBaseUpdateChallengeInput_UpdateInput(): UpdateChallengeInput_Upda
endDate: undefined,
status: undefined,
overview: undefined,
constraints: undefined,
};
}

Expand Down Expand Up @@ -2812,6 +2918,9 @@ export const UpdateChallengeInput_UpdateInput = {
if (message.overview !== undefined) {
Challenge_Overview.encode(message.overview, writer.uint32(202).fork()).ldelim();
}
if (message.constraints !== undefined) {
Challenge_Constraint.encode(message.constraints, writer.uint32(210).fork()).ldelim();
}
return writer;
},

Expand Down Expand Up @@ -2997,6 +3106,13 @@ export const UpdateChallengeInput_UpdateInput = {

message.overview = Challenge_Overview.decode(reader, reader.uint32());
continue;
case 26:
if (tag !== 210) {
break;
}

message.constraints = Challenge_Constraint.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
Expand Down Expand Up @@ -3053,6 +3169,7 @@ export const UpdateChallengeInput_UpdateInput = {
endDate: isSet(object.endDate) ? String(object.endDate) : undefined,
status: isSet(object.status) ? String(object.status) : undefined,
overview: isSet(object.overview) ? Challenge_Overview.fromJSON(object.overview) : undefined,
constraints: isSet(object.constraints) ? Challenge_Constraint.fromJSON(object.constraints) : undefined,
};
},

Expand Down Expand Up @@ -3105,6 +3222,8 @@ export const UpdateChallengeInput_UpdateInput = {
message.status !== undefined && (obj.status = message.status);
message.overview !== undefined &&
(obj.overview = message.overview ? Challenge_Overview.toJSON(message.overview) : undefined);
message.constraints !== undefined &&
(obj.constraints = message.constraints ? Challenge_Constraint.toJSON(message.constraints) : undefined);
return obj;
},

Expand Down Expand Up @@ -3171,6 +3290,9 @@ export const UpdateChallengeInput_UpdateInput = {
message.overview = (object.overview !== undefined && object.overview !== null)
? Challenge_Overview.fromPartial(object.overview)
: undefined;
message.constraints = (object.constraints !== undefined && object.constraints !== null)
? Challenge_Constraint.fromPartial(object.constraints)
: undefined;
return message;
},
};
Expand Down
7 changes: 7 additions & 0 deletions src/schema/Challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ export const ChallengeSchema: Schema = {
totalPrizesInCents: { type: DataType.DATA_TYPE_NUMBER, format: "integer" },
},
},
constraints: {
type: DataType.DATA_TYPE_MAP,
itemType: DataType.DATA_TYPE_MAP,
items: {
allowedRegistrants: { type: DataType.DATA_TYPE_LIST, itemType: DataType.DATA_TYPE_STRING },
},
},
},
indices: {
legacyId: {
Expand Down
40 changes: 20 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -946,35 +946,35 @@
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==

"@topcoder-framework/client-relational@^0.21.0":
version "0.21.0"
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"
integrity sha512-8wl6t0Ro/1AosmNTBW54/ySh40tE+lk/MQIXNIRIUdmvX+kt4B6ukFwdvR0qPcOAzqi3o59v08sVPLiPukhYFw==
"@topcoder-framework/client-relational@^0.22.0":
version "0.22.0"
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/client-relational/-/client-relational-0.22.0.tgz#0e096758ffd8c9d0eb986b2f9328ed247930abfe"
integrity sha512-We0sb8pdxOZfzX8WzKxczhXl16jmZ6cN/eBgDv5jR8qpVoXhLTa2iaTLqiRYUWi9ZvHCN6vmNQ607w0IU/iRFQ==
dependencies:
"@grpc/grpc-js" "^1.8.0"
"@topcoder-framework/lib-common" "^0.21.0"
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.57-beta-1"
"@topcoder-framework/lib-common" "^0.22.0"
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.58-beta-1"
tslib "^2.4.1"

"@topcoder-framework/domain-acl@^0.21.0":
version "0.21.0"
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"
integrity sha512-jN6jjywWnsIjE2GN1fdsitsc/inJP4DuXtWW+c9o/Gt4UJUTlx3Thss7aC/GTenV0wQtLaTgRldxSMdUvBadiQ==
"@topcoder-framework/domain-acl@^0.22.0":
version "0.22.0"
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/domain-acl/-/domain-acl-0.22.0.tgz#31b238f011a30a8c8e91f69dabb225d3d22dfae1"
integrity sha512-7pQhbzAFFUKloT/Q2/btOdOKRBhLvbjviLBIyOiWLIJXJoIvPlVRAH+Ub+Bx0/1KLPSynKvEyyAw7zx+aB5jbA==
dependencies:
"@grpc/grpc-js" "^1.8.7"
"@topcoder-framework/client-relational" "^0.21.0"
"@topcoder-framework/lib-common" "^0.21.0"
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.57-beta-1"
"@topcoder-framework/client-relational" "^0.22.0"
"@topcoder-framework/lib-common" "^0.22.0"
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.58-beta-1"
tslib "^2.4.1"

"@topcoder-framework/lib-common@^0.21.0":
version "0.21.0"
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"
integrity sha512-yLHWy5Q3PP6fS6rwwQAmpv54C8LuGKMns+CT7DUQcRX1+OJN4ozINQ5sezjzGx22GnODxsHbk5PbjMJpG/Pc+g==
"@topcoder-framework/lib-common@^0.22.0":
version "0.22.0"
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/lib-common/-/lib-common-0.22.0.tgz#bd3428b0199410a5151326d1d9731c404c255fb5"
integrity sha512-sHdOAyCGcNaDT9esc9Q3sNaqvVAwHPv6NCTlTAt5O9dcSpdz2AyEur8mS5WccFclKhF5ZB9BM1bbWxO8i9WXGQ==
dependencies:
"@grpc/grpc-js" "^1.8.0"
rimraf "^3.0.2"
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.57-beta-1"
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.58-beta-1"
tslib "^2.4.1"

"@tsconfig/node10@^1.0.7":
Expand Down Expand Up @@ -2698,9 +2698,9 @@ topcoder-bus-api-wrapper@topcoder-platform/tc-bus-api-wrapper.git:
superagent "^3.8.3"
tc-core-library-js appirio-tech/tc-core-library-js.git#v2.6.4

"topcoder-interface@github:topcoder-platform/plat-interface-definition#v0.0.57-beta-1":
"topcoder-interface@github:topcoder-platform/plat-interface-definition#v0.0.58-beta-1":
version "1.0.0"
resolved "https://codeload.github.com/topcoder-platform/plat-interface-definition/tar.gz/af7812437904275e62f85182515764ef218ff75f"
resolved "https://codeload.github.com/topcoder-platform/plat-interface-definition/tar.gz/474bcfa1d01f0f2d0a2658de21aa835f4c824c44"

topo@3.x.x:
version "3.0.3"
Expand Down