-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from NJUPT-SAST/update-readme
Update readme
- Loading branch information
Showing
10 changed files
with
208 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,107 @@ | ||
# sast-link-backend | ||
# SAST Link | ||
|
||
[SAST Link Logo](https://aliyun.sastimg.mxte.cc/images/2023/07/02/footera9663bd5ff4b2bad.png) | ||
|
||
Logo designed by [SAST](https://sast.fun/), created by [Maxtune Lee](https://github.com/MaxtuneLee). | ||
|
||
[![Go Report Card](https://goreportcard.com/badge/github.com/NJUPT-SAST/sast-link-backend)](https://goreportcard.com/report/github.com/NJUPT-SAST/sast-link-backend) | ||
[![License](https://img.shields.io/badge/license-AGPLv3-blue.svg)](https://choosealicense.com/licenses/agpl-3.0/) | ||
|
||
SAST Link is a comprehensive personnel management system and OAuth designed to provide a secure and efficient way to manage and authorize access to your applications and services. | ||
|
||
Product design in Figma: [SAST Link](https://www.figma.com/file/IUIoRll3ieYFzJSfJPelDu/sast-link?node-id=0-1&t=rtc1sJfjJ0aTDAkp-0), designed by [Maxtune Lee](https://github.com/MaxtuneLee) | ||
|
||
This repository contains the backend code for SAST Link. If you're interested in the frontend, please visit [SAST Link frontend](https://github.com/NJUPT-SAST/sast-link). | ||
|
||
SAST Link backend is built with Go and PostgreSQL, and use gin as the web framework. | ||
|
||
> [!WARNING] | ||
> This repo is under active development! Formats, schemas, and APIs are subject to rapid and backward incompatible changes! | ||
## Getting Started | ||
|
||
### Pre-requisites | ||
|
||
- Go | ||
- PostgreSQL | ||
- Redis | ||
- Email Account (SMTP) | ||
- Tencent COS (For file storage) | ||
- Oauth2.0 Provider (e.g. GitHub, Feishu) | ||
|
||
Create PostgreSQL database and tables by running the SQL scripts in `sql/` directory. | ||
|
||
### Clone and Run | ||
|
||
To get started with SAST Link, follow these steps: | ||
|
||
1. Configuration: First, create a configuration file based on `config/dev-example.toml`. Ensure that you provide appropriate configurations for your environment. | ||
2. Environment Setup: Set up the environment variable `CONFIG_FILE` to specify the configuration file you've created. | ||
3. Installation and Execution: | ||
|
||
```bash | ||
git clone https://github.com/NJUPT-SAST/sast-link-backend.git && cd sast-link-backend | ||
CONFIG_FILE=dev-example go run . | ||
``` | ||
|
||
The server will listen port `8080`, you can change it by add a `PORT` environment variable. | ||
|
||
## Development | ||
|
||
### API Documentation | ||
|
||
The API documentation is available at [wiki](https://github.com/NJUPT-SAST/sast-link-backend/wiki/Api-Doc) | ||
|
||
### Database Schema | ||
|
||
The database schema is available at [wiki](https://github.com/NJUPT-SAST/sast-link-backend/wiki/Project-Structure#sql) | ||
|
||
### Code Workflow Explanation | ||
|
||
The code workflow is available at [wiki](https://github.com/NJUPT-SAST/sast-link-backend/wiki/General) | ||
|
||
## Roadmap | ||
|
||
Goals and Vision for SAST Link (SAST OAuth and SAST Profile): | ||
|
||
**SAST OAuth:** | ||
|
||
SAST OAuth serves as a unified identity authentication system for SAST, facilitating login across multiple SAST applications. | ||
|
||
Example: | ||
|
||
- Simplifies login processes for SAST members across various projects, such as the FreshCup competition. | ||
- Enables seamless login via SAST credentials without the need for separate accounts for each project. | ||
- Allows SAST lecturers to access and manage the FreshCup competition system for tasks like grading via SAST login. | ||
- Offers multiple login options including SAST Feishu, PassKey, QQ, Github, etc., providing users with convenience and flexibility. | ||
- Implements additional security measures like F2A and security keys to enhance account security. | ||
|
||
In login process, users can choose to log in in multiple ways: SAST Feishu, PassKey, QQ, Github, etc. As long as they have been bound in advance, they can use third-party login, which is convenient and fast. They can also use F2A, security keys, and other methods to enhance account security. | ||
|
||
**SAST Profile:** | ||
|
||
SAST Profile acts as a centralized user profile system for managing user information and settings within SAST applications. | ||
|
||
Features: | ||
|
||
- Records basic user information such as SAST membership status, current position, department, group affiliation, etc. | ||
- Tracks user activities within SAST, including competition results, awards, and permissions across various applications. | ||
- Provides users with the ability to customize and share their profile page, allowing them to control the visibility of their information. | ||
|
||
**Current status**: | ||
|
||
- [x] User Management (Basic) | ||
- [x] SAST OAuth (Basic) | ||
- [x] File Storage (Tencent COS) | ||
- [x] SAST Profile (Basic) | ||
- [] SAST Link management | ||
- [] Third-party OAuth (Github and Feishu now can be used in backend, but not fully implemente) | ||
|
||
## Contributing | ||
|
||
Pull requests and any feedback are welcome. For major changes, please open an issue first | ||
to discuss what you would like to change. | ||
|
||
## License | ||
|
||
[AGPLv3 ](https://choosealicense.com/licenses/agpl-3.0/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- public."admin" definition | ||
|
||
-- Drop table | ||
|
||
-- DROP TABLE public."admin"; | ||
|
||
CREATE TABLE public."admin" ( | ||
id serial4 NOT NULL, | ||
created_at timestamp NOT NULL DEFAULT now(), | ||
user_id varchar(255) NOT NULL, | ||
CONSTRAINT admin_pkey PRIMARY KEY (id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
-- public.carrer_records definition | ||
|
||
-- Drop table | ||
|
||
-- DROP TABLE public.carrer_records; | ||
|
||
CREATE TABLE public.carrer_records ( | ||
id serial4 NOT NULL, | ||
user_id int4 NOT NULL, -- 与user表映射,表示某个用户的生涯记录 | ||
org_id int2 NOT NULL, -- 与orgnize表映射,表示用户该届所在的组织 | ||
grade int2 NOT NULL, -- 表示某一届(如:2023届) | ||
is_delete bool NOT NULL, -- 假删 | ||
"position" varchar(2) NULL, -- 包括:部员、讲师、组长、部长、主席 | ||
CONSTRAINT carrer_records_pkey PRIMARY KEY (id) | ||
); | ||
|
||
-- Column comments | ||
|
||
COMMENT ON COLUMN public.carrer_records.user_id IS '与user表映射,表示某个用户的生涯记录'; | ||
COMMENT ON COLUMN public.carrer_records.org_id IS '与orgnize表映射,表示用户该届所在的组织'; | ||
COMMENT ON COLUMN public.carrer_records.grade IS '表示某一届(如:2023届)'; | ||
COMMENT ON COLUMN public.carrer_records.is_delete IS '假删'; | ||
COMMENT ON COLUMN public.carrer_records."position" IS '包括:部员、讲师、组长、部长、主席'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- public.organize definition | ||
|
||
-- Drop table | ||
|
||
-- DROP TABLE public.organize; | ||
|
||
CREATE TABLE public.organize ( | ||
id int4 NOT NULL DEFAULT nextval('department_id_seq'::regclass), | ||
dep varchar(255) NOT NULL, | ||
org varchar(255) NULL, | ||
CONSTRAINT department_pkey PRIMARY KEY (id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
-- public.profile definition | ||
|
||
-- Drop table | ||
|
||
-- DROP TABLE public.profile; | ||
|
||
CREATE TABLE public.profile ( | ||
id serial4 NOT NULL, | ||
user_id int4 NOT NULL, -- 与user表映射 | ||
nickname varchar(255) NOT NULL, -- 昵称 | ||
org_id int2 NOT NULL, -- 对应部门和组的信息(现在的职位,历史职位的信息在carrer_records中) | ||
bio varchar(255) NULL, -- 自我介绍 | ||
email varchar(255) NOT NULL, -- 邮箱(默认展示) | ||
badge json NULL, -- 纪念卡 | ||
link _varchar NULL, -- 个人链接(包括自己b站、博客、GitHub等账号链接) | ||
avatar varchar(255) NULL, -- 头像(存储oss链接) | ||
is_deleted bool NOT NULL, -- 假删 | ||
hide _varchar NULL, -- 选择隐藏的信息 | ||
CONSTRAINT profile_pkey PRIMARY KEY (id) | ||
); | ||
|
||
-- Column comments | ||
|
||
COMMENT ON COLUMN public.profile.user_id IS '与user表映射'; | ||
COMMENT ON COLUMN public.profile.nickname IS '昵称'; | ||
COMMENT ON COLUMN public.profile.org_id IS '对应部门和组的信息(现在的职位,历史职位的信息在carrer_records中)'; | ||
COMMENT ON COLUMN public.profile.bio IS '自我介绍'; | ||
COMMENT ON COLUMN public.profile.email IS '邮箱(默认展示)'; | ||
COMMENT ON COLUMN public.profile.badge IS '纪念卡'; | ||
COMMENT ON COLUMN public.profile.link IS '个人链接(包括自己b站、博客、GitHub等账号链接)'; | ||
COMMENT ON COLUMN public.profile.avatar IS '头像(存储oss链接)'; | ||
COMMENT ON COLUMN public.profile.is_deleted IS '假删'; | ||
COMMENT ON COLUMN public.profile.hide IS '选择隐藏的信息'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- public."user" definition | ||
|
||
-- Drop table | ||
|
||
-- DROP TABLE public."user"; | ||
|
||
CREATE TABLE public."user" ( | ||
id serial4 NOT NULL, | ||
created_at timestamp NOT NULL DEFAULT now(), | ||
email varchar(255) NOT NULL, | ||
uid varchar(255) NOT NULL, | ||
qq_id varchar(255) NULL, | ||
lark_id varchar(255) NULL, | ||
github_id varchar(255) NULL, | ||
wechat_id varchar(255) NULL, | ||
is_deleted bool NOT NULL, | ||
"password" varchar(255) NOT NULL, | ||
CONSTRAINT user_pkey PRIMARY KEY (id) | ||
); |