code100x / algorithmic-arena

91 stars 96 forks source link

Merge Judge0 DB into Common DB #33

Closed SujithThirumalaisamy closed 2 weeks ago

SujithThirumalaisamy commented 2 weeks ago

Resolves: #5 Done it by adding the schema of judge0 into main database and optimise it further to make judge0 access the database without any issues and get rid of the callback.

siinghd commented 2 weeks ago

Can we do something like this tbh:

const testCases = problem.inputs.map((input, index) => ({
    submissionId: submission.id,
    judge0TrackingId: // this would be unque something like cuuid or uuid
    ...
}));

await db.testCase.createMany({ data: testCases });

const response = await axios.post(
    `${JUDGE0_URI}/submissions/batch?base64_encoded=false`,
    {
        submissions: testCases.map(testCase => ({
            language_id: LANGUAGE_MAPPING[submissionInput.data.languageId]?.judge0,
            source_code: problem.fullBoilerplateCode,
            stdin: testCase.input,
            expected_output: testCase.expected_output,
            callback_url: `${process.env.BASE_URL}/submission-callback/${testCase.judge0TrackingId}`,
        })),
    }
);

@hkirat @SujithThirumalaisamy

hkirat commented 2 weeks ago

/bounty $50