Skip to content

Commit

Permalink
Merge branch 'dev' into feat/queue-strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Hoplin authored Feb 17, 2024
2 parents d66e23d + 4b7b0a9 commit e4d99d8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
- J-Hoplin: Backend & Infrastructure
- Oseungkwon: Frontend

## Web Scraper

Use web scraper to fill problem and problem example datas. **You need to run this scraper after you execute `Online Judge System` once.**

- [Repository](https://github.com/J-Hoplin/Online-Judge-Scraper)

## Contents

- [📦Diagram](#diagram)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- AlterTable
ALTER TABLE `problem` MODIFY `problem` LONGTEXT NOT NULL,
MODIFY `input` LONGTEXT NOT NULL,
MODIFY `output` LONGTEXT NOT NULL;
10 changes: 5 additions & 5 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ enum UserType {
model Problem {
id Int @id @default(autoincrement())
title String @default("New Problem") // 제목
problem String @default("Problem Here") // 문제
input String @default("Input Here") // 입력
output String @default("Output Here") // 출력
problem String @db.LongText // 문제
input String @db.LongText // 입력
output String @db.LongText // 출력
timeLimit Int @default(5) // 시간제한(Second)
memoryLimit Int @default(128) // 메모리제한(MB)
// 1:N relation with User
Expand All @@ -69,8 +69,8 @@ model Problem {

model ProblemExample {
id Int @id @default(autoincrement())
input String @default("")
output String @default("")
input String @db.LongText
output String @db.LongText
isPublic Boolean @default(true) // If it's public example
// 1:N relation with Problem
Expand Down
3 changes: 3 additions & 0 deletions src/judge/contributer/contributer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export class ContributerService {
return this.prisma.problem.create({
data: {
title: 'New Problem',
problem: 'Problem Here',
input: 'Input Here',
output: 'Output Here',
contributerId: uid,
tags: [],
},
Expand Down
3 changes: 2 additions & 1 deletion src/judge/judge.controller.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ describe('/judge Judge Controller', () => {
it('should generate problme example', async () => {
const example = await request(app.getHttpServer())
.post(`/judge/contribute/problems/${problemId}/examples`)
.set('Authorization', BearerTokenHeader(adminToken));
.set('Authorization', BearerTokenHeader(adminToken))
.send({ input: 'Example', output: 'Output', isPublic: true });
expect(example.statusCode).toBe(201);
exampleId = example.body['id'];
});
Expand Down
9 changes: 9 additions & 0 deletions src/judge/judge.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ describe('JudgeService', () => {
problem1 = await prisma.problem.create({
data: {
title: 'Have Example',
problem: '',
input: '',
output: '',
contributerId: user1.id,
tags: [],
isOpen: true,
Expand All @@ -97,6 +100,9 @@ describe('JudgeService', () => {
problem2 = await prisma.problem.create({
data: {
title: 'No Example',
problem: '',
input: '',
output: '',
contributerId: user1.id,
tags: [],
isOpen: true,
Expand All @@ -106,6 +112,9 @@ describe('JudgeService', () => {
problem3 = await prisma.problem.create({
data: {
title: 'Closed Problem',
problem: '',
input: '',
output: '',
contributerId: user1.id,
tags: [],
isOpen: false,
Expand Down

0 comments on commit e4d99d8

Please sign in to comment.