- Introduced a new test file for setting up an in-memory SQLite database for testing purposes. - Added helper functions for seeding test data, including users, plans, subscriptions, and wallet transactions. - Implemented usage helpers to load user video counts and storage usage. - Created user payload struct and functions to build user payloads with preferences and wallet balance. - Refactored gRPC server setup to include new services and handlers. - Updated proto files to simplify service definitions by removing redundant service prefixes.
104 lines
2.6 KiB
Protocol Buffer
104 lines
2.6 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package stream.app.v1;
|
|
|
|
option go_package = "stream.api/internal/gen/proto/app/v1;appv1";
|
|
import "google/protobuf/wrappers.proto";
|
|
import "app/v1/common.proto";
|
|
|
|
service Account {
|
|
rpc GetMe(GetMeRequest) returns (GetMeResponse);
|
|
rpc UpdateMe(UpdateMeRequest) returns (UpdateMeResponse);
|
|
rpc DeleteMe(DeleteMeRequest) returns (MessageResponse);
|
|
rpc ClearMyData(ClearMyDataRequest) returns (MessageResponse);
|
|
rpc GetUserById (google.protobuf.StringValue) returns (User) {}
|
|
rpc GetPreferences(GetPreferencesRequest) returns (GetPreferencesResponse);
|
|
rpc UpdatePreferences(UpdatePreferencesRequest) returns (UpdatePreferencesResponse);
|
|
}
|
|
|
|
service Usage {
|
|
rpc GetUsage(GetUsageRequest) returns (GetUsageResponse);
|
|
}
|
|
|
|
service Notifications {
|
|
rpc ListNotifications(ListNotificationsRequest) returns (ListNotificationsResponse);
|
|
rpc MarkNotificationRead(MarkNotificationReadRequest) returns (MessageResponse);
|
|
rpc MarkAllNotificationsRead(MarkAllNotificationsReadRequest) returns (MessageResponse);
|
|
rpc DeleteNotification(DeleteNotificationRequest) returns (MessageResponse);
|
|
rpc ClearNotifications(ClearNotificationsRequest) returns (MessageResponse);
|
|
}
|
|
|
|
message GetMeRequest {}
|
|
|
|
message GetMeResponse {
|
|
User user = 1;
|
|
}
|
|
|
|
message UpdateMeRequest {
|
|
optional string username = 1;
|
|
optional string email = 2;
|
|
optional string language = 3;
|
|
optional string locale = 4;
|
|
optional string telegram_id = 5;
|
|
}
|
|
|
|
message UpdateMeResponse {
|
|
User user = 1;
|
|
}
|
|
|
|
message DeleteMeRequest {}
|
|
|
|
message ClearMyDataRequest {}
|
|
|
|
message GetPreferencesRequest {}
|
|
|
|
message GetPreferencesResponse {
|
|
Preferences preferences = 1;
|
|
}
|
|
|
|
message UpdatePreferencesRequest {
|
|
optional bool email_notifications = 1;
|
|
optional bool push_notifications = 2;
|
|
optional bool marketing_notifications = 3;
|
|
optional bool telegram_notifications = 4;
|
|
optional bool autoplay = 5;
|
|
optional bool loop = 6;
|
|
optional bool muted = 7;
|
|
optional bool show_controls = 8;
|
|
optional bool pip = 9;
|
|
optional bool airplay = 10;
|
|
optional bool chromecast = 11;
|
|
optional string language = 12;
|
|
optional string locale = 13;
|
|
}
|
|
|
|
message UpdatePreferencesResponse {
|
|
Preferences preferences = 1;
|
|
}
|
|
|
|
message GetUsageRequest {}
|
|
|
|
message GetUsageResponse {
|
|
string user_id = 1;
|
|
int64 total_videos = 2;
|
|
int64 total_storage = 3;
|
|
}
|
|
|
|
message ListNotificationsRequest {}
|
|
|
|
message ListNotificationsResponse {
|
|
repeated Notification notifications = 1;
|
|
}
|
|
|
|
message MarkNotificationReadRequest {
|
|
string id = 1;
|
|
}
|
|
|
|
message MarkAllNotificationsReadRequest {}
|
|
|
|
message DeleteNotificationRequest {
|
|
string id = 1;
|
|
}
|
|
|
|
message ClearNotificationsRequest {}
|