Skip to content
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

feat(submission): wip- legacy submission #8

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"grpc-server-reflection": "^0.1.5",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"moment-timezone": "^0.5.41",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use dayjs - it's what we use in ACL generally

"source-map-support": "^0.5.21",
"topcoder-interface": "github:topcoder-platform/plat-interface-definition#v0.0.23",
"uuidv4": "^6.2.13"
Expand Down
14 changes: 14 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import assert from "assert";

export const ENV = <string>process.env.ENV || "local";
export const TIME_ZONE = <string>process.env.TIME_ZONE || "America/New_York";

export const GRPC_SERVER_HOST = process.env.GRPC_SERVER_HOST || "localhost";
export const GRPC_SERVER_PORT = process.env.GRPC_SERVER_PORT || 9090;

export const GRPC_RDB_SERVER_HOST = process.env.GRPC_RDB_SERVER_HOST;
export const GRPC_RDB_SERVER_PORT = process.env.GRPC_RDB_SERVER_PORT;


assert(GRPC_RDB_SERVER_HOST, "GRPC_RDB_SERVER_HOST is required");
assert(GRPC_RDB_SERVER_PORT, "GRPC_RDB_SERVER_PORT is required");
25 changes: 25 additions & 0 deletions src/domain/LegacyResourceSubmission.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { QueryBuilder } from '@topcoder-framework/client-relational';

import { queryRunner } from '../helper/QueryRunner';
import { CreateResourceSubmissionInput } from '../models/domain-layer/legacy/resource_submission';
import { ResourceSubmissionSchema } from '../schema/resource/ResourceSubmission';


class LegacyResourceSubmissionDomain {
public async create(input: CreateResourceSubmissionInput): Promise<boolean> {
const query = new QueryBuilder(ResourceSubmissionSchema)
.insert({
submission_id: input.submissionId,
resource_id: input.resourceId,
create_date: input.createDate as string,
update_date: input.modifyDate as string,
create_user: input.createUser as number,
modify_user: input.modifyUser as number,
})
.build();
await queryRunner.run(query);
return true;
}
}

export default new LegacyResourceSubmissionDomain();
Loading