Skip to content

Commit 0187f54

Browse files
committed
feat: list challenge phases
0 parents  commit 0187f54

33 files changed

+11107
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
reflections/
3+
dist/
4+
.env
5+
.DS_Store

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Topcoder Domain - Resource
2+
3+
gRPC service for topcoder anti-corruption layer. This service keeps the writes to the legacy database to keep the legacy system happy and available for all legacy systems that interact with it.
4+
5+
Note that this is still in the initial stages of development and a lot of things might change rapidly. ACL, non-related domains like Challenge, Payment are embedded in this service and will likely be moved to their own services in the future.

bin/nosql-client.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
require("dotenv").config();
2+
3+
const path = require("path");
4+
const { execSync } = require("child_process");
5+
const rimraf = require("rimraf");
6+
7+
const PROTO_DIR = process.env.GRPC_NOSQL_PROTO_PATH;
8+
const MODEL_DIR = path.join(__dirname, "../src/dal/models/nosql/");
9+
10+
const PROTOC_PATH = "protoc";
11+
const PLUGIN_PATH = path.join(
12+
__dirname,
13+
"../node_modules/.bin/protoc-gen-ts_proto"
14+
);
15+
16+
rimraf.sync(`${MODEL_DIR}/*`, {
17+
glob: { ignore: `${MODEL_DIR}/tsconfig.json` },
18+
});
19+
20+
const protoConfig = [
21+
`--plugin=${PLUGIN_PATH}`,
22+
// https://github.com/stephenh/ts-proto/blob/main/README.markdown
23+
"--ts_proto_opt=outputServices=grpc-js,env=node,useOptionals=messages,exportCommonSymbols=false,esModuleInterop=true",
24+
`--ts_proto_opt=oneof=unions`,
25+
`--ts_proto_opt=addGrpcMetadata=true`,
26+
`--ts_proto_opt=outputServerImpl=false`,
27+
`--ts_proto_out=${MODEL_DIR}`,
28+
`--proto_path ${PROTO_DIR} ${PROTO_DIR}/*.proto`,
29+
];
30+
31+
// https://github.com/stephenh/ts-proto#usage
32+
execSync(`${PROTOC_PATH} ${protoConfig.join(" ")}`);
33+
34+
console.log(`> Proto models created: ${MODEL_DIR}`);

bin/rdb-client.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
require("dotenv").config();
2+
3+
const path = require("path");
4+
const { execSync } = require("child_process");
5+
const rimraf = require("rimraf");
6+
7+
const PROTO_DIR = process.env.GRPC_RDB_PROTO_PATH;
8+
const MODEL_DIR = path.join(__dirname, "../src/dal/models/rdb/");
9+
10+
const PROTOC_PATH = "protoc";
11+
const PLUGIN_PATH = path.join(
12+
__dirname,
13+
"../node_modules/.bin/protoc-gen-ts_proto"
14+
);
15+
16+
rimraf.sync(`${MODEL_DIR}/*`, {
17+
glob: { ignore: `${MODEL_DIR}/tsconfig.json` },
18+
});
19+
20+
const protoConfig = [
21+
`--plugin=${PLUGIN_PATH}`,
22+
// https://github.com/stephenh/ts-proto/blob/main/README.markdown
23+
"--ts_proto_opt=outputServices=grpc-js,env=node,useOptionals=messages,exportCommonSymbols=false,esModuleInterop=true",
24+
`--ts_proto_opt=oneof=unions`,
25+
`--ts_proto_opt=addGrpcMetadata=true`,
26+
`--ts_proto_opt=outputServerImpl=false`,
27+
`--ts_proto_out=${MODEL_DIR}`,
28+
`--proto_path ${PROTO_DIR} ${PROTO_DIR}/*.proto`,
29+
`--include_imports`,
30+
];
31+
32+
// https://github.com/stephenh/ts-proto#usage
33+
execSync(`${PROTOC_PATH} ${protoConfig.join(" ")}`);
34+
35+
console.log(`> Proto models created: ${MODEL_DIR}`);

bin/server.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
require("dotenv").config();
2+
3+
const path = require("path");
4+
const { execSync } = require("child_process");
5+
const rimraf = require("rimraf");
6+
7+
const PROTO_DIR = process.env.PROTO_PATH;
8+
const PROTO_REFLECTIONS = path.join(__dirname, "../reflections/reflection.bin");
9+
10+
const MODEL_DIR = path.join(__dirname, "../src/models/");
11+
12+
const PROTOC_PATH = "protoc";
13+
const PLUGIN_PATH = path.join(
14+
__dirname,
15+
"../node_modules/.bin/protoc-gen-ts_proto"
16+
);
17+
18+
rimraf.sync(`${MODEL_DIR}/*`, {
19+
glob: { ignore: `${MODEL_DIR}/tsconfig.json` },
20+
});
21+
22+
const protoConfig = [
23+
`--plugin=${PLUGIN_PATH}`,
24+
// https://github.com/stephenh/ts-proto/blob/main/README.markdown
25+
"--ts_proto_opt=outputServices=grpc-js,env=node,useOptionals=messages,exportCommonSymbols=false,esModuleInterop=true",
26+
`--ts_proto_out=${MODEL_DIR}`,
27+
`--proto_path ${PROTO_DIR} ${PROTO_DIR}/**/*.proto`,
28+
`--ts_proto_opt=oneof=unions`,
29+
`--ts_proto_opt=addGrpcMetadata=true`,
30+
`--ts_proto_opt=outputClientImpl=false`,
31+
`--descriptor_set_out ${PROTO_REFLECTIONS}`,
32+
`--include_imports`,
33+
];
34+
35+
// https://github.com/stephenh/ts-proto#usage
36+
execSync(`${PROTOC_PATH} ${protoConfig.join(" ")}`);
37+
38+
console.log(`> Proto models created: ${MODEL_DIR}`);

0 commit comments

Comments
 (0)