diff --git a/src/migrations/1623077854175-AddStdErrStdOut.ts b/src/migrations/1623077854175-AddStdErrStdOut.ts new file mode 100644 index 0000000..7ce7038 --- /dev/null +++ b/src/migrations/1623077854175-AddStdErrStdOut.ts @@ -0,0 +1,18 @@ +import {MigrationInterface, QueryRunner} from "typeorm"; + +export class AddStdErrStdOut1623077854175 implements MigrationInterface { + name = 'AddStdErrStdOut1623077854175' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "submissions" DROP COLUMN "output"`); + await queryRunner.query(`ALTER TABLE "submissions" ADD "stdout" character varying`); + await queryRunner.query(`ALTER TABLE "submissions" ADD "stderr" character varying`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "submissions" DROP COLUMN "stderr"`); + await queryRunner.query(`ALTER TABLE "submissions" DROP COLUMN "stdout"`); + await queryRunner.query(`ALTER TABLE "submissions" ADD "output" character varying`); + } + +} diff --git a/src/submissions/submission.entity.ts b/src/submissions/submission.entity.ts index 69a1d8b..6637ba6 100644 --- a/src/submissions/submission.entity.ts +++ b/src/submissions/submission.entity.ts @@ -41,7 +41,11 @@ export class Submission extends BaseEntity { @jsonMember @Column({ nullable: true }) - output: string; + stdout: string; + + @jsonMember + @Column({ nullable: true }) + stderr: string; @jsonMember @ApiProperty() diff --git a/src/submissions/submissions.service.ts b/src/submissions/submissions.service.ts index c2def68..e01fba3 100644 --- a/src/submissions/submissions.service.ts +++ b/src/submissions/submissions.service.ts @@ -27,15 +27,19 @@ export class SubmissionsService { async setStatus( id: string, status: string, - output?: string, + stdout?: string, + stderr?: string, ): Promise { const submission = await this.submissionsRepository.findOne({ id, }); if (submission) { submission.status = status; - if (output) { - submission.output = output; + if (stdout) { + submission.stdout = stdout; + } + if (stderr) { + submission.stderr = stderr; } await submission.save(); return submission;