This commit is contained in:
2026-10-07 01:43:28 +07:00
parent 494b3fc471
commit e0caa0b409
23 changed files with 5264 additions and 963 deletions
+214 -13
View File
@@ -277,6 +277,62 @@ service EveningDetectiveServer {
};
}
rpc GetPlaylists(GetPlaylistsReq) returns (GetPlaylistsRsp) {
option (google.api.http) = { get: "/api/playlists" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Музыка";
summary: "Получить плейлисты";
};
}
rpc CreatePlaylist(CreatePlaylistReq) returns (CreatePlaylistRsp) {
option (google.api.http) = { post: "/api/playlists" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Музыка";
summary: "Создать плейлист";
};
}
rpc UpdatePlaylist(UpdatePlaylistReq) returns (UpdatePlaylistRsp) {
option (google.api.http) = { put: "/api/playlists/{ID}" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Музыка";
summary: "Изменить плейлист";
};
}
rpc DeletePlaylist(DeletePlaylistReq) returns (DeletePlaylistRsp) {
option (google.api.http) = { delete: "/api/playlists/{ID}" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Музыка";
summary: "Удалить плейлист";
};
}
rpc UploadPlaylistTrack(UploadPlaylistTrackReq) returns (UploadPlaylistTrackRsp) {
option (google.api.http) = { post: "/api/playlists/{playlistID}/tracks" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Музыка";
summary: "Загрузить MP3 в плейлист";
};
}
rpc DeletePlaylistTrack(DeletePlaylistTrackReq) returns (DeletePlaylistTrackRsp) {
option (google.api.http) = { delete: "/api/playlists/{playlistID}/tracks/{trackID}" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Музыка";
summary: "Удалить MP3 из плейлиста";
};
}
rpc SetScenarioPlaylist(SetScenarioPlaylistReq) returns (SetScenarioPlaylistRsp) {
option (google.api.http) = { put: "/api/scenarios/{ID}/playlist" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Музыка";
summary: "Назначить плейлист сценарию";
};
}
rpc AddScenario(AddScenarioReq) returns (AddScenarioRsp) {
option (google.api.http) = {
post: "/api/scenario"
@@ -596,6 +652,31 @@ service EveningDetectiveServer {
};
}
rpc GetGameMusic(GetGameMusicReq) returns (GetGameMusicRsp) {
option (google.api.http) = { get: "/api/games/{gameID}/music" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Музыка";
summary: "Получить музыку игры";
};
}
rpc SetGameMusic(SetGameMusicReq) returns (SetGameMusicRsp) {
option (google.api.http) = { post: "/api/games/{gameID}/music" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Музыка";
summary: "Изменить музыку игры";
};
}
rpc AdvanceScreenMusic(AdvanceScreenMusicReq) returns (AdvanceScreenMusicRsp) {
option (google.api.http) = { post: "/api/screens/music/advance" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: { security_requirement: {} }
tags : "Музыка";
summary : "Перейти к следующему треку экрана";
};
}
// Привязать экран к игре. Требует авторизацию организатора, автора или администратора.
rpc BindScreen(BindScreenReq) returns (BindScreenRsp) {
option (google.api.http) = {
@@ -1164,6 +1245,73 @@ message DownloadFileReq {
string filename = 1;
}
message PlaylistTrack {
int32 ID = 1;
string name = 2;
string filename = 3;
int32 position = 4;
}
message Playlist {
int32 ID = 1;
string name = 2;
repeated PlaylistTrack tracks = 3;
}
message GetPlaylistsReq {}
message GetPlaylistsRsp {
repeated Playlist playlists = 1;
}
message CreatePlaylistReq {
string name = 1;
}
message CreatePlaylistRsp {
Playlist playlist = 1;
}
message UpdatePlaylistReq {
int32 ID = 1;
string name = 2;
}
message UpdatePlaylistRsp {
Playlist playlist = 1;
}
message DeletePlaylistReq {
int32 ID = 1;
}
message DeletePlaylistRsp {}
message UploadPlaylistTrackReq {
int32 playlistID = 1;
string name = 2;
string filename = 3;
bytes data = 4;
}
message UploadPlaylistTrackRsp {
Playlist playlist = 1;
}
message DeletePlaylistTrackReq {
int32 playlistID = 1;
int32 trackID = 2;
}
message DeletePlaylistTrackRsp {}
message SetScenarioPlaylistReq {
int32 ID = 1;
int32 playlistID = 2;
}
message SetScenarioPlaylistRsp {}
message AddScenarioReq {
string name = 1;
}
@@ -1193,19 +1341,20 @@ message GetScenarioRsp {
}
message Scenario {
int32 ID = 1;
string name = 2;
optional string description = 3;
optional string image = 4;
Story story = 5;
string status = 6;
User author = 7;
google.protobuf.Timestamp updated_at = 8;
google.protobuf.Timestamp created_at = 9;
google.protobuf.Timestamp published_at = 10;
double average_rating = 11;
int32 reviews_count = 12;
string difficulty = 13;
int32 ID = 1;
string name = 2;
optional string description = 3;
optional string image = 4;
Story story = 5;
string status = 6;
User author = 7;
google.protobuf.Timestamp updated_at = 8;
google.protobuf.Timestamp created_at = 9;
google.protobuf.Timestamp published_at = 10;
double average_rating = 11;
int32 reviews_count = 12;
string difficulty = 13;
optional int32 music_playlist_id = 14 [json_name = "music_playlist_id"];
}
message Story {
@@ -1487,6 +1636,7 @@ message ScreenState {
int64 timer_remaining_seconds = 18;
ScreenTimerState timer_state = 19;
string text = 20;
MusicState music = 21;
}
message CreateScreenSessionReq {}
@@ -1513,6 +1663,57 @@ message GetGameScreensRsp {
repeated ScreenState screens = 1;
}
enum MusicPlaybackState {
MUSIC_PLAYBACK_UNSPECIFIED = 0;
MUSIC_PLAYBACK_STOPPED = 1;
MUSIC_PLAYBACK_PLAYING = 2;
MUSIC_PLAYBACK_PAUSED = 3;
}
message MusicState {
Playlist playlist = 1;
int32 track_index = 2;
int64 position_ms = 3;
int32 volume = 4;
bool loop = 5;
MusicPlaybackState playback = 6;
int64 state_version = 7;
}
message GetGameMusicReq {
int32 gameID = 1;
}
message GetGameMusicRsp {
repeated Playlist playlists = 1;
MusicState state = 2;
int32 scenario_playlist_id = 3;
int32 game_playlist_id = 4;
}
message SetGameMusicReq {
int32 gameID = 1;
int32 playlistID = 2;
int32 track_index = 3;
int64 position_ms = 4;
int32 volume = 5;
bool loop = 6;
MusicPlaybackState playback = 7;
}
message SetGameMusicRsp {
MusicState state = 1;
}
message AdvanceScreenMusicReq {
string screenID = 1;
string accessToken = 2;
}
message AdvanceScreenMusicRsp {
MusicState state = 1;
}
message BindScreenReq {
string screenID = 1;
string accessToken = 2;