diff --git a/build.rs b/build.rs index 9cece3b..a17c4bc 100644 --- a/build.rs +++ b/build.rs @@ -35,9 +35,12 @@ static TARGETS: Lazy>> = Lazy::new(|| { "models", vec![ "./proto/models/core/network.proto", + "./proto/models/domain/site.proto", + "./proto/models/rbac/resource.proto", + "./proto/models/rbac/resource_action.proto", + "./proto/models/rbac/role.proto", "./proto/models/member/member_class.proto", "./proto/models/member/member_level.proto", - "./proto/models/member/member_site.proto", "./proto/models/member/member.proto", "./proto/models/member/member_session.proto", ], diff --git a/proto/models/domain/site.proto b/proto/models/domain/site.proto new file mode 100644 index 0000000..24bf858 --- /dev/null +++ b/proto/models/domain/site.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package bet.beteran.domain; + +message Site { + string id = 1; + string url = 2; + bool show = 3; + bool can_use = 4; + uint64 created_at = 5; + uint64 updated_at = 6; + optional uint64 deleted_at = 7; +} diff --git a/proto/models/member/member.proto b/proto/models/member/member.proto index 8ddf9a9..bbcb4fd 100644 --- a/proto/models/member/member.proto +++ b/proto/models/member/member.proto @@ -2,9 +2,10 @@ syntax = "proto3"; package bet.beteran.member; +import "models/domain/site.proto"; + import "models/member/member_class.proto"; import "models/member/member_level.proto"; -import "models/member/member_site.proto"; enum MemberState { @@ -19,20 +20,19 @@ enum MemberState { message Member { string id = 1; - string domain_id = 2; + bet.beteran.domain.Site site = 2; MemberClass member_class = 3; MemberLevel member_level = 4; - MemberSite member_site = 5; - optional Member referrer = 6; - uint64 referred_count = 7; - string username = 8; - string nickname = 9; - optional string mobile_phone_number = 10; - MemberState state = 11; - optional uint64 state_changed_at = 12; - optional string last_signined_ip = 13; - optional uint64 last_signined_at = 14; - uint64 created_at = 15; - uint64 updated_at = 16; - optional uint64 deleted_at = 17; + optional Member referrer = 5; + uint64 referred_count = 6; + string username = 7; + string nickname = 8; + optional string mobile_phone_number = 9; + MemberState state = 10; + optional uint64 state_changed_at = 11; + optional string last_signined_ip = 12; + optional uint64 last_signined_at = 13; + uint64 created_at = 14; + uint64 updated_at = 15; + optional uint64 deleted_at = 16; } diff --git a/proto/models/member/member_permission.proto b/proto/models/member/member_permission.proto new file mode 100644 index 0000000..e69de29 diff --git a/proto/models/member/member_role.proto b/proto/models/member/member_role.proto new file mode 100644 index 0000000..e69de29 diff --git a/proto/models/member/member_site.proto b/proto/models/member/member_site.proto deleted file mode 100644 index 76735f0..0000000 --- a/proto/models/member/member_site.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; - -package bet.beteran.member; - -message MemberSite { - string id = 1; - string url = 2; - uint64 created_at = 3; - uint64 updated_at = 4; - optional uint64 deleted_at = 5; -} diff --git a/proto/models/rbac/resource.proto b/proto/models/rbac/resource.proto new file mode 100644 index 0000000..b502b1a --- /dev/null +++ b/proto/models/rbac/resource.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package bet.beteran.rbac; + +message Resource { + string id = 1; + Resource parent = 2; + string name = 3; + string key = 4; + string description = 5; + bool can_use = 6; + uint64 created_at = 7; + uint64 updated_at = 8; +} diff --git a/proto/models/rbac/resource_action.proto b/proto/models/rbac/resource_action.proto new file mode 100644 index 0000000..d4ce175 --- /dev/null +++ b/proto/models/rbac/resource_action.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package bet.beteran.rbac; + +import "models/rbac/resource.proto"; + +message ResourceAction { + string id = 1; + Resource resource = 2; + string name = 3; + string key = 4; + string description = 5; + bool can_use = 6; + uint64 created_at = 7; + uint64 updated_at = 8; +} diff --git a/proto/models/rbac/role.proto b/proto/models/rbac/role.proto new file mode 100644 index 0000000..ce9ddf5 --- /dev/null +++ b/proto/models/rbac/role.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package bet.beteran.rbac; + +import "models/rbac/resource.proto"; + +message Role { + string id = 1; + Role parent = 2; + string name = 3; + string key = 4; + string description = 5; + bool can_use = 6; + uint64 created_at = 7; + uint64 updated_at = 8; +}