syntax = "proto3"; import "protobuf/src/google/protobuf/empty.proto"; import "protobuf/src/google/protobuf/timestamp.proto"; option go_package = "github.com/ChausseBenjamin/rafta/pkg/model"; message UUID { string value = 1; } enum TaskState { TASK_UNDEFINED = 0; TASK_PENDING = 1; TASK_IN_PROGRESS = 2; TASK_DONE = 3; TASK_BLOCKED = 4; } message UserData { string name = 1; string email = 2; google.protobuf.Timestamp created_on = 3; google.protobuf.Timestamp last_login = 4; } message User { UUID id = 1; UserData data = 2; } // Used only by admin users to create users manually since he cannot use it's // own jwt to create a non admin user. message UserCreationMsg { UserData userData = 1; string userSecret = 2; } message TaskRecurrence { string cron = 1; bool active = 2; } message TaskData { string title = 1; string desc = 2; // markdown // Intentionally vague for easy client implementation: uint32 priority = 3; // 0=undefined, 1=highest, 0xFFFFFFFF=lowest TaskState state = 4; TaskRecurrence recurrence = 5; google.protobuf.Timestamp created_on = 6; google.protobuf.Timestamp last_updated = 7; repeated string tags = 8; } message TaskUpdate { UUID id = 1; oneof field { string title = 2; string desc = 3; uint32 priority = 4; TaskState state = 5; TaskRecurrence recurrence = 6; } } message Task { UUID id = 1; TaskData data = 2; } message TaskList { repeated Task tasks = 1; } message UserList { repeated User users = 1; } // Accessible to all users once authenticated // User can only manipulate its own data service RaftaUser { // Retrieval rpc GetUserInfo(google.protobuf.Empty) returns (User); rpc GetTask(UUID) returns (Task); // User Manipulation rpc NewUser(UserData) returns (User); rpc UpdateUserInfo(User) returns (google.protobuf.Empty); // Input is empty because user should be authenticated via JWT rpc DeleteUser(google.protobuf.Empty) returns (google.protobuf.Empty); // Task Manipulation rpc DeleteTask(UUID) returns (google.protobuf.Empty); rpc UpdateTask(TaskUpdate) returns (google.protobuf.Empty); rpc CreateTask(TaskData) returns (Task); } // Accessible only to users with the admin role service RaftaAdmin { // Retrieval rpc GetUserTasks(UUID) returns (TaskList); rpc GetAllUsers(google.protobuf.Empty) returns (UserList); rpc GetUser(UUID) returns (User); // User Manipulation rpc DeleteUser(UUID) returns (google.protobuf.Empty); rpc UpdateUser(User) returns (google.protobuf.Empty); rpc CreateUser(UserCreationMsg) returns (User); }