Skip to content

Homework for DB && Linux course built with Oat++.

License

Notifications You must be signed in to change notification settings

resyon/hw-2021Fall-server

 
 

Repository files navigation

HW-Fall2021

话不多说, 就是给Linux数据库 两门课准备的大作业

Feature

题目2 档案管理系统(不超过5人)

档案管理系统是一套功能强大、操作简便、实用的自动化管理软件,包括用户管理、档案数据录入(分为文件录入和案卷录入2部分)、案卷数据查询(分为文件查询和案卷查询2部分)、借阅管理等。可以应用于一般的档案室,也可以应用于网络中的办公系统,进行联网操作。

基本功能需要:

  1. 用户登录在用户进入系统前,首先要求用户进行,登录时要验证用户名和密码是否匹配,验证通过后允许用户进入本系统操作。
  2. 修改注册信息:用户登录后,可以修改自己的注册信息,包括修改用户密码、每页显示行数等信息,不允许修改用户名、姓名和部门等信息。
  3. 权限设置:本模块只有系统管理员可以操作。管理员可以增加系统用户、删除系统用户、修改用户的相关属性、修改用户的权限表。
  4. 数据录入:本模块处理用户输入新的档案文件信息或者档案案卷信息。输入数据时要考虑用户连续录入的情况,可以从上一条记录复制数据到新的记录中。
  5. 数据维护:本模块需要具有“数据维护”的权限的用户可以操作。数据维护模块对已经“删除”(只是做删除标记)的档案文件做最后判定,判断该文件是否需要删除。此模块涉及两种操作:恢复和彻底删除。
  6. 数据查询:按用户输入的条件查询相应的档案文件信息。查询结果以列表目录形式显示,也可以卡片形式显示。具有档案处理权限的用户可以对查询的结果编辑并保存,也可以“删除”(做删除标记)档案文件记录。
  7. 数据修改:本模块主要实现批量修改数据的功能,可以由用户指定条件,将数据库中所有符合条件的文件或案卷记录按要求修改某个字段的值。例如:可以指定将所有文件年份为“2002”的文件记录的保管期限改为“长期”。
  8. 档案借阅:此模块分为外借登记、归还记录和电子借阅申请处理两部分,具有“借阅管理”权限的用户可以操作此模块。外借模块实现档案文件的借出登记和归还登记功能。电子借阅申请由具有“借阅管理”权限的用户处理。一般用户提出阅读电子文档的请求后,被同意阅读后,文件将被发送给申请人。

一期(给Linux作业)

单个管理员,简化权限

  1. 登录验证,用户账号新建
  2. 档案借阅(申请/审批)
  3. 数据录入/查询
  4. 借阅记录

interface

METHOD URL REQUEST DESCRIPTION
GET /user/login ?name={username}&password={password} login
POST /user {"name":"example_name","password":"example_pass","avatar":"https://this_is_a_url_of_picture", "email":"e@a.com"} create a user

Base on Example-CRUD Build Status

A complete example of a "CRUD" service (UserService) built with Oat++.

In this example:

  • How to create CRUD endpoint.
  • How to use oatpp ORM - SQLite example.
  • How to document API with Swagger-UI and OpenApi 3.0.0.

More about Oat++:

Overview

This project is using the following oatpp modules:

Project layout

|- CMakeLists.txt                        // projects CMakeLists.txt
|- sql/                                  // SQL migration scripts for SQLite database
|- src/
|   |
|   |- controller/                       // Folder containing REST Controllers (UserController)
|   |- db/                               // Folder containing the database client
|   |- dto/                              // DTOs are declared here
|   |- service/                          // Service business logic classes (UserService)
|   |- AppComponent.hpp                  // Service config
|   |- DatabaseComponent.hpp             // Database config
|   |- SwaggerComponent.hpp              // Swagger-UI config
|   |- App.cpp                           // main() is here
|
|- test/                                 // test folder
|- utility/install-oatpp-modules.sh      // utility script to install required oatpp-modules.

Build and Run

Using CMake

Pre Requirements
  • oatpp
  • oatpp-swagger
  • oatpp-sqlite with -DOATPP_SQLITE_AMALGAMATION=ON cmake flag.

Note: You may run utility/install-oatpp-modules.sh script to install required oatpp modules.

Build Project
$ mkdir build && cd build
$ cmake ..
$ make 
$ ./crud-exe        # - run application.

In Docker

$ docker build -t example-crud .
$ docker run -p 8000:8000 -t example-crud

Endpoints

HTML

HTTP Method URL Description
GET http://localhost:8000/ Root page
GET http://localhost:8000/swagger/ui Swagger UI page

User Service

HTTP Method URL Description
POST http://localhost:8000/users Create new User
PUT http://localhost:8000/users/{userId} Update User by ID
GET http://localhost:8000/users/{userId} Get User by ID
DELETE http://localhost:8000/users/{userId} Delete User by ID
GET http://localhost:8000/users/offset/{offset}/limit/{limit} Get All Users with Paging

About

Homework for DB && Linux course built with Oat++.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 93.5%
  • CMake 4.0%
  • Shell 1.7%
  • Other 0.8%