Skip to content

Commit e2677b8

Browse files
committed
feat: switch to @topcoder-framework/lib-common and @topcoder-framwork/client-relational
Signed-off-by: Rakib Ansary <rakibansary@gmail.com>
1 parent 72cf261 commit e2677b8

27 files changed

+58
-6578
lines changed

bin/nosql-client.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

bin/rdb-client.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

bin/server.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable */
12
const path = require("path");
23
const rimraf = require("rimraf");
34

@@ -7,26 +8,31 @@ const PROTO_DIR = path.join(__dirname, "../node_modules/topcoder-interface");
78
const PROTO_REFLECTIONS = path.join(__dirname, "../reflections/reflection.bin");
89

910
const MODEL_DIR = path.join(__dirname, "../src/models/");
10-
1111
const PROTOC_PATH = "protoc";
1212
const PLUGIN_PATH = path.join(__dirname, "../node_modules/.bin/protoc-gen-ts_proto");
1313

1414
rimraf.sync(`${MODEL_DIR}/*`, {
15-
glob: { ignore: `${MODEL_DIR}/tsconfig.json` },
15+
glob: { ignore: `${MODEL_DIR}/*.json` },
1616
});
1717

1818
const protoConfig = [
1919
`--plugin=${PLUGIN_PATH}`,
2020
// https://github.com/stephenh/ts-proto/blob/main/README.markdown
2121
"--ts_proto_opt=outputServices=grpc-js,env=node,useOptionals=messages,exportCommonSymbols=false,esModuleInterop=true",
22-
`--ts_proto_out=${MODEL_DIR}`,
22+
`--ts_proto_opt=stringEnums=true`,
23+
`--ts_proto_opt=useDate=string`,
2324
`--ts_proto_opt=oneof=unions`,
2425
`--ts_proto_opt=addGrpcMetadata=true`,
2526
`--ts_proto_opt=outputClientImpl=false`,
26-
`--ts_proto_opt=useDate=string`,
27-
`--include_imports`,
2827
`--descriptor_set_out ${PROTO_REFLECTIONS}`,
29-
`--proto_path ${PROTO_DIR} ${PROTO_DIR}/domain-layer/legacy/**/*.proto`,
28+
`--include_imports`,
29+
`--ts_proto_opt=Mcommon/common.proto=@topcoder-framework/lib-common`,
30+
`--ts_proto_opt=Mgoogle/protobuf/struct.proto=@topcoder-framework/lib-common`,
31+
`--ts_proto_opt=Mgoogle/protobuf/timestamp.proto=@topcoder-framework/lib-common`,
32+
`--ts_proto_opt=Mgoogle/protobuf/empty.proto=@topcoder-framework/lib-common`,
33+
`--proto_path ${PROTO_DIR} ${PROTO_DIR}/domain-layer/legacy/*.proto`,
34+
`--proto_path ${PROTO_DIR} ${PROTO_DIR}/domain-layer/legacy/services/*.proto`,
35+
`--ts_proto_out=${MODEL_DIR}`,
3036
];
3137

3238
// https://github.com/stephenh/ts-proto#usage

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"build:proto:client:nosql": "node bin/nosql-client",
8-
"build:proto:client:rdb": "node bin/rdb-client",
97
"build:proto:server": "node bin/server",
10-
"build:proto": "node bin/rdb-client && node bin/nosql-client && node bin/server",
8+
"build:proto": "node bin/server",
119
"build:app": "rimraf dist && tsc -b",
12-
"build": "node bin/rdb-client && node bin/nosql-client && node bin/server && rimraf dist && tsc -b",
10+
"build": "node bin/server && rimraf dist && tsc -b",
11+
"clean": "rimraf dist",
1312
"start": "ts-node-dev --respawn --transpile-only src/server.ts"
1413
},
1514
"keywords": [],
@@ -18,6 +17,7 @@
1817
"dependencies": {
1918
"@grpc/grpc-js": "^1.7.1",
2019
"@topcoder-framework/client-relational": "^0.4.23-ci.0",
20+
"@topcoder-framework/lib-common": "^0.4.23-ci.0",
2121
"dayjs": "^1.11.5",
2222
"dotenv": "^16.0.3",
2323
"grpc-server-reflection": "^0.1.5",

src/domain/LegacyChallenge.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { ColumnType, Operator, QueryRequest } from "@topcoder-framework/client-relational";
2+
import { Value } from "@topcoder-framework/lib-common";
13
import { QueryRunner } from "../common/QueryRunner";
2-
import { ColumnType, Operator, QueryRequest } from "../grpc/models/rdb/relational";
3-
import { CheckChallengeExistsResponse } from "../models/domain-layer/legacy/legacy_challenge";
4-
import { Value } from "../models/google/protobuf/struct";
4+
import { CheckChallengeExistsResponse } from "../models/domain-layer/legacy/challenge";
55
import { Project } from "../schema/project/Project";
66

77
class LegacyChallengeDomain {

src/domain/LegacyChallengePhase.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
import _ from "lodash";
2-
3-
import { PhaseTypeList } from "../models/domain-layer/legacy/legacy_challenge_phase";
4-
51
import { QueryRunner } from "../common/QueryRunner";
6-
import { Value } from "../grpc/models/rdb/relational";
7-
8-
import { ProjectPhaseSchema } from "../schema/project/ProjectPhase";
2+
import { Value } from "@topcoder-framework/client-relational";
3+
import { CreatePhaseInput, PhaseTypeList } from "../models/domain-layer/legacy/challenge_phase";
94
import { PhaseType } from "../schema/project/PhaseType";
10-
import {
11-
CreatePhaseInput,
12-
CreateResult,
13-
} from "../models/domain-layer/legacy/services/legacy_challenge_phase";
5+
import { ProjectPhaseSchema } from "../schema/project/ProjectPhase";
6+
import { CreateResult } from "@topcoder-framework/lib-common";
147

158
class LegacyChallengePhaseDomain {
169
public async create(input: CreatePhaseInput): Promise<CreateResult> {

src/grpc/client/nosql.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/grpc/client/relational.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)