Skip to content

sustech-cs304/simple-oj

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

backend document


0. setup

  1. use mysql, url: localhost:3306/oj'
  2. python backend env
conda create -n webenv python=3.10
conda activate webenv
conda install -c conda-forge flask=2.2.3
conda install -c conda-forge pydantic=1.10.5
pip3 install -r requirements.txt

1. Overview

1.1 Response

返回给前端的类, ==截图仅供参考! 重新在本机测试!==

{
    "data"
:
    self.data,
        // 返回数据
        "status_code"
:
    self.status_code,
        "message"
:
    self.message
    // 表示状态的信息(not found, invalid...)
}

1.2 User

  1. user拥有三个权限 level1: ”学生“用户, level2: ”老师“用户, level3: super user
  2. username: 用户名, nickname: 用于展示的昵称

1.3 json格式

  1. to_json_lite: 不带object名, 数组中使用
    [
        {
            //obj1...
        },
        {
            //obj2...
        }
    ]
  2. to_json: 带object名, 其它情况使用
    // 放入 Response message 中的 problem 对象
    "message": {
        "problem": {
            //content...
        }
    }

1.4 时间格式

使用 datetime.datetime, isoformat()


2. Problem

  1. 获取题目列表 / 单个题目, 老师创建题目 contributor: nickname start_time: 题目创建时间 status: 预留值 tag: 预留标签

  2. get all problems

  3. get single problem

  4. create problem


3. Submit (code)

  1. create submit submit1.png
  2. get all submit histories submit2.png
  3. get submit histories of somebody submit3.png
  4. get submit histories of specific question
  5. get submit histories of specific question of somebody

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.4%
  • Shell 0.6%