blob: 7480c551bad330335791e9a55966637fb9d6cde6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
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);
}
|