7 Commits

Author SHA1 Message Date
a18a5c423b sessions: remove SessionsService.Get
I can't think of any scenario where getting a session by ID is required.
2025-07-25 20:22:08 -07:00
a3a63a8475 sessions: track StyleID 2025-07-25 20:19:47 -07:00
149ee727ca sessions: track GameID 2025-07-25 20:09:09 -07:00
8a5f33b1b4 times: record attempt number to time entry 2025-07-25 19:58:51 -07:00
62ffc6a365 sessions: aggregate request 2025-07-25 19:49:31 -07:00
1969f9e2fe sessions: extend with attempts 2025-07-25 19:46:17 -07:00
55c8dfd379 sessions 2025-07-25 19:43:10 -07:00
5 changed files with 80 additions and 19 deletions

View File

@@ -24,19 +24,22 @@ message IdMessage {
message MapResponse {
int64 ID = 1;
string DisplayName = 2;
string Creator = 3;
int32 GameID = 4;
uint64 Thumbnail = 6;
int64 Date = 5;
}
message MapRequest {
int64 ID = 1;
optional string DisplayName = 2;
optional string Creator = 3;
optional int32 GameID = 4;
optional uint64 Thumbnail = 6;
optional int64 Date = 5;
}
message MapFilter {
optional string DisplayName = 2;
optional string Creator = 3;
optional int32 GameID = 4;
}
@@ -55,4 +58,5 @@ message Pagination {
}
message NullResponse {
}
}

View File

@@ -11,12 +11,8 @@ do
--prost_out=$module \
--tonic_out=$module \
$f
# prost codegen is wrong!
sed -i "s/tonic::codec::ProstCodec/tonic_prost::ProstCodec/g" "$module/$name.rs"
#I couldn't figure out how to configure protoc to do this
sed -i "s/#\[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)\]/#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]\n#\[derive(serde::Serialize, serde::Deserialize)\]\n#\[serde(rename_all = \"PascalCase\")\]/g" "$module/$name.rs"
sed -i "s/#\[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)\]/#\[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)\]\n#\[derive(serde::Serialize, serde::Deserialize)\]\n#\[serde(rename_all = \"PascalCase\")\]/g" "$module/$name.rs"
sed -i "s/#\[derive(Clone, PartialEq, ::prost::Message)\]/#\[derive(Clone, PartialEq, ::prost::Message)\]\n#\[derive(serde::Serialize, serde::Deserialize)\]\n#\[serde(rename_all = \"PascalCase\")\]/g" "$module/$name.rs"
sed -i "s/, PartialEq, ::prost::Message)\]/, PartialEq, ::prost::Message, serde::Serialize, serde::Deserialize)\]\n#\[serde(rename_all = \"PascalCase\")\]/g" "$module/$name.rs"
sed -i "s/ pub id:/ #\[serde(rename = \"ID\")\]\n pub id:/g" "$module/$name.rs"
sed -i "s/ pub map_id:/ #\[serde(rename = \"MapID\")\]\n pub map_id:/g" "$module/$name.rs"
sed -i "s/ pub time_id:/ #\[serde(rename = \"TimeID\")\]\n pub time_id:/g" "$module/$name.rs"

67
sessions.proto Normal file
View File

@@ -0,0 +1,67 @@
syntax = "proto3";
option go_package = "git.itzana.me/strafesnet/go-grpc/sessions";
package sessions;
service SessionsService {
rpc Create(SessionCreate) returns (SessionId);
rpc List(ListRequest) returns (SessionList);
rpc Aggregate(SessionFilter) returns (SessionAggregate);
}
message SessionIdList { repeated int64 ID = 1; }
message SessionId { int64 ID = 1; }
message SessionResponse {
int64 ID = 1;
uint64 UserID = 2;
uint64 MapID = 3;
int64 Date = 4;
uint32 Duration = 5;
uint32 Attempts = 6;
uint32 GameID = 7;
uint32 StyleID = 8;
}
message SessionCreate {
uint64 UserID = 1;
uint64 MapID = 2;
int64 Date = 3;
uint32 Duration = 4;
uint32 Attempts = 5;
uint32 GameID = 6;
uint32 StyleID = 7;
}
enum SessionSort {
SessionSortDateDescending = 0;
}
message SessionFilter {
optional uint64 UserID = 1;
optional uint64 MapID = 2;
optional uint32 GameID = 3;
optional uint32 StyleID = 4;
}
message SessionList { repeated SessionResponse Sessions = 1; }
message ListRequest {
SessionFilter Filter = 1;
Pagination Page = 2;
Sort SessionSort = 3;
}
message Pagination {
uint32 Size = 1;
uint32 Number = 2;
}
message SessionAggregate {
uint64 Duration = 1;
uint64 Attempts = 2;
}
message NullResponse {}

View File

@@ -28,6 +28,7 @@ message TimeRequest {
optional int32 StyleID = 6;
optional int32 ModeID = 7;
optional int32 GameID = 8;
optional uint32 Attempt = 9;
}
message TimeFilter {
@@ -51,6 +52,9 @@ message TimeResponse {
int32 StyleID = 7;
int32 ModeID = 8;
int32 GameID = 9;
// How many times did the player leave the start zone
// during their full play history of the map
uint32 Attempt = 10;
}
message IdMessage {
@@ -100,4 +104,4 @@ message Pagination {
message NullResponse {
}
}

View File

@@ -2,8 +2,6 @@ syntax = "proto3";
option go_package = "git.itzana.me/strafesnet/go-grpc/validator";
import "maps_extended.proto";
package validator;
service ValidatorMapfixService {
@@ -16,7 +14,6 @@ service ValidatorMapfixService {
rpc SetStatusValidated(MapfixID) returns (NullResponse);
rpc SetStatusFailed(MapfixID) returns (NullResponse);
rpc SetStatusUploaded(MapfixID) returns (NullResponse);
rpc SetStatusReleased(MapfixReleaseRequest) returns (NullResponse);
}
service ValidatorSubmissionService {
@@ -29,7 +26,6 @@ service ValidatorSubmissionService {
rpc SetStatusValidated(SubmissionID) returns (NullResponse);
rpc SetStatusFailed(SubmissionID) returns (NullResponse);
rpc SetStatusUploaded(StatusUploadedRequest) returns (NullResponse);
rpc SetStatusReleased(maps_extended.MapCreate) returns (NullResponse);
}
message MapfixID { uint64 ID = 1; }
@@ -93,12 +89,6 @@ message StatusUploadedRequest {
uint64 UploadedAssetID = 2;
}
message MapfixReleaseRequest {
uint64 ID = 1;
uint64 AssetVersion = 2;
uint32 Modes = 3;
}
message NullResponse {}
// Operations