feat(p1): complete P1 foundation stage
- monorepo: pnpm workspace + go.work + pyproject.toml + commitlint/husky - infra: docker-compose (minimal + full profiles) + init-sql + prometheus - arch-scan: multi-language scanner skeleton (TS/Go/Python/Proto) - shared-proto: buf v2 + classes.proto (ClassService CRUD contract) - api-gateway: Go/Gin + JWT HS256 auth + reverse proxy + request ID - classes: NestJS golden template (error system + observability + middleware + CRUD + tests) - teacher-portal: Next.js + paper-feel UI design system - CI/CD: 4 workflows (go/ts/py/proto) - docs: migration guide + project_rules + coding-standards + git-workflow + ui-design-system + 004 + 9 module READMEs + known-issues + spec/plan migration + roadmap
This commit is contained in:
8
packages/shared-proto/buf.gen.yaml
Normal file
8
packages/shared-proto/buf.gen.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
version: v2
|
||||
plugins:
|
||||
- remote: buf.build/protocolbuffers/go
|
||||
out: ../shared-go/gen/proto
|
||||
- remote: buf.build/protocolbuffers/js
|
||||
out: ../shared-ts/gen/proto
|
||||
- remote: buf.build/protocolbuffers/python
|
||||
out: ../shared-py/gen/proto
|
||||
9
packages/shared-proto/buf.yaml
Normal file
9
packages/shared-proto/buf.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
version: v2
|
||||
modules:
|
||||
- path: proto
|
||||
lint:
|
||||
use:
|
||||
- STANDARD
|
||||
breaking:
|
||||
use:
|
||||
- FILE
|
||||
10
packages/shared-proto/package.json
Normal file
10
packages/shared-proto/package.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@edu/shared-proto",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"lint": "buf lint",
|
||||
"breaking": "buf breaking --against .git#branch=main",
|
||||
"generate": "buf generate"
|
||||
}
|
||||
}
|
||||
58
packages/shared-proto/proto/classes.proto
Normal file
58
packages/shared-proto/proto/classes.proto
Normal file
@@ -0,0 +1,58 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package next_edu_cloud.classes.v1;
|
||||
|
||||
// ClassService 定义班级域 CRUD 契约
|
||||
// P1: REST 实现,P3 起转 gRPC
|
||||
service ClassService {
|
||||
rpc CreateClass(CreateClassRequest) returns (Class);
|
||||
rpc GetClass(GetClassRequest) returns (Class);
|
||||
rpc ListClasses(ListClassesRequest) returns (ListClassesResponse);
|
||||
rpc UpdateClass(UpdateClassRequest) returns (Class);
|
||||
rpc DeleteClass(DeleteClassRequest) returns (Empty);
|
||||
}
|
||||
|
||||
message Class {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string grade_id = 3;
|
||||
string head_teacher_id = 4;
|
||||
string description = 5;
|
||||
int64 created_at = 6;
|
||||
int64 updated_at = 7;
|
||||
}
|
||||
|
||||
message CreateClassRequest {
|
||||
string name = 1;
|
||||
string grade_id = 2;
|
||||
string head_teacher_id = 3;
|
||||
string description = 4;
|
||||
}
|
||||
|
||||
message GetClassRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message ListClassesRequest {
|
||||
string grade_id = 1;
|
||||
int32 page_size = 2;
|
||||
string page_token = 3;
|
||||
}
|
||||
|
||||
message ListClassesResponse {
|
||||
repeated Class classes = 1;
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
message UpdateClassRequest {
|
||||
string id = 1;
|
||||
optional string name = 2;
|
||||
optional string head_teacher_id = 3;
|
||||
optional string description = 4;
|
||||
}
|
||||
|
||||
message DeleteClassRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message Empty {}
|
||||
Reference in New Issue
Block a user