Skip to content

Dcard backend 2023 assignment ๐Ÿ“š, featuring Docker compose ๐Ÿณ, RESTful API & gRPC services ๐Ÿ› ๏ธ, with PostgreSQL database ๐Ÿ—ƒ๏ธ. It includes swagger & gRPC documentation ๐Ÿ“–, tests ๐Ÿงช, and explores database performance optimizations ๐Ÿš€.

Notifications You must be signed in to change notification settings

peterxcli/linked-page

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

27 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

dcard backend - linked page

setup

use docker compose

docker compose up -d

or

install

make install

test

make test

run

make

link to http://localhost:9000/swagger/index.html to view or interact with the openAPI docs

service endpoints

RESTful api : port 9000

https://peterxcli.github.io/linked-page/

gRPC :

list proto : port 9001

syntax = "proto3";
option go_package = "/protos/list";
service List {
    rpc GetList(GetListRequest) returns (GetListResponse);
    rpc PatchList(PatchListRequest) returns (SetHeadResponse);
    rpc InsertList(InsertListRequest) returns (SetHeadResponse);
}

message GetListRequest {
    uint32 ListId = 1;
    uint32 UserId = 2;
}

message GetListResponse {
    uint32 ListId = 1;
    uint32 UserId = 2;
    uint32 HeadId = 3;
}

message PatchListRequest {
	uint32 ListId = 1;
	uint32 UserId = 2;
	uint32 HeadId = 3;
}

message InsertListRequest {
	uint32 ListId = 1;
	uint32 UserId = 2;
	uint32 HeadId = 3;
}

message SetHeadResponse {
    bool IsSuccess = 1;
}

page proto :

syntax = "proto3";
option go_package = "/proto/page";

service Page {
    rpc GetPage(GetPageRequest) returns (GetPageResponse);
    rpc SetPage(SetPageRequest) returns (SetPageResponse);
    rpc InsertPage(InsertPageRequest) returns (InsertPageResponse);
    rpc DeletePageCertainHourBefore(DeletePageRequest) returns (DeletePageResponse);
    rpc DeletePage(DeletePageRequest) returns (DeletePageResponse);
}

message GetPageRequest {
    uint32 PageId = 1;
}

message GetPageResponse {
    uint32 PageId = 1;
	uint32 NextPageId = 2;
	uint32 PrevPageId = 3;
    repeated uint32 ArticleIds = 4;
}

message SetPageRequest {
	uint32 PageId = 1;
    uint32 NextPageId = 2;
    uint32 PrevPageId = 3;
    repeated uint32 ArticleIds = 4;
}

message SetPageResponse {
    bool IsSuccess = 1;
}

message InsertPageRequest {
    uint32 PageId = 1;
    uint32 NextPageId = 2;
    uint32 PrevPageId = 3;
    repeated uint32 ArticleIds = 4;
}

message InsertPageResponse {
    bool IsSuccess = 1;
    uint32 NewPageId = 2;
}

message DeletePageRequest {
    uint32 PageId = 1;
    int32 Hour = 2;
}

message DeletePageResponse {
    uint32 RowAffected = 1;
}

Why use PostgresSQL?

PostgreSQL is a powerful and versatile relational database management system that is open source and free to use. Here are some of the reasons why you might choose to use PostgreSQL:

  1. Reliability and Stability: PostgreSQL is known for its reliability and stability, even when dealing with large amounts of data and complex queries. It has a reputation for being a robust database that is used by many large organizations and businesses.

  2. Scalability: PostgreSQL is designed to handle high traffic and a large number of users. It can easily scale up to handle growing amounts of data and increased demand.

  3. Advanced Features: PostgreSQL has many advanced features that make it a popular choice for developers. These include support for JSON, XML, and spatial data types, as well as advanced indexing and query optimization.

  4. Extensibility: PostgreSQL is highly extensible, allowing developers to add custom functionality through its extensive library of extensions and plugins.

  5. Open Source: PostgreSQL is an open source database, meaning that it is freely available and can be modified and customized to fit your specific needs. This can save you money on licensing fees and provide greater flexibility in your development process.


  • ๅ—šๅ—šๅ—šๅฏซไธๅฎŒไบ†QQ

defect

  • ๆ•ด้ซ”ๅฏซๅพ—ไธ้Œฏ๏ผŒ็‰นๅˆฅๆ˜ฏๆŽก็”จ swagger & gRPC ้€™ไธ€้ปžใ€‚
  • ่ณ‡ๆ–™ๅบซ็š„้ธ็”จๅปบ่ญฐๅคšๆถ‰ๅˆ—ไธ€ไบ›ไธๅŒ็š„้กžๅž‹๏ผŒๆฏ”่ผƒไน‹้–“็š„ๅทฎๅˆฅๅ’Œ้ฉ็”จๆƒ…ๆณ๏ผŒๅƒๆ˜ฏ Scalability ๆœƒๅฅฝๅฅ‡ๆ˜ฏๅ’Œไป€้บผ DB ๅš็‚บๅฐ่ฑกๆฏ”่ผƒ
  • ๆˆ‘ๅ€‘ๆœŸๅพ…็œ‹ๅˆฐๅœจๅˆช้™คไธŠๆœ‰ไธ€ไบ›้€ฒ้šŽ็š„่™•็†๏ผŒๆ€Ž้บผๅฎ‰ๆŽ’ๅ„ฒๅญ˜ๆ–นๅผๅฏไปฅๅคงๆ‰นๅˆช้™คๅˆไธๅฝฑ้Ÿฟ DB ็š„ๆ•ˆ่ƒฝ
  • ๆœ‰ๅฏซๆธฌ่ฉฆ้€™้ปžๅพˆไธ้Œฏ๏ผŒไฝ†ๅœ˜้šŠๅปบ่ญฐๅšๆ›ดๅฎŒๆ•ด็š„ๆธฌ่ฉฆ๏ผŒๅŒ…ๅซ่ผƒๅคšๆƒ…ๅขƒๆˆ–่€…้Œฏ่ชค็š„ๆธฌ่ฉฆ็ญ‰็ญ‰

About

Dcard backend 2023 assignment ๐Ÿ“š, featuring Docker compose ๐Ÿณ, RESTful API & gRPC services ๐Ÿ› ๏ธ, with PostgreSQL database ๐Ÿ—ƒ๏ธ. It includes swagger & gRPC documentation ๐Ÿ“–, tests ๐Ÿงช, and explores database performance optimizations ๐Ÿš€.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published