diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/AuthorizationService.proto b/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/AuthorizationService.proto deleted file mode 100644 index 8d1a942..0000000 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/AuthorizationService.proto +++ /dev/null @@ -1,62 +0,0 @@ -syntax = "proto3"; - -import "org/timemates/api/authorizations/requests/StartAuthorizationRequest.proto"; -import "org/timemates/api/authorizations/requests/ConfirmAuthorizationRequest.proto"; -import "org/timemates/api/authorizations/requests/GetAuthorizationsRequest.proto"; -import "org/timemates/api/authorizations/options/OmitAuthorizationOption.proto"; -import "org/timemates/api/authorizations/requests/CreateProfileRequest.proto"; -import "org/timemates/api/authorizations/requests/RenewAuthorizationRequest.proto"; -import "org/timemates/api/authorizations/types/Authorization.proto"; -import "google/protobuf/empty.proto"; - -option java_package = "org.timemates.api.authorizations"; - -service AuthorizationService { - /** - * Starts authorization by sending corresponding email to email address. - * - * Has next restrictions: - * – 3 requests per email is max. - */ - rpc startAuthorization(StartAuthorizationRequest) returns (StartAuthorizationRequest.Result) { - option (omit_authorization) = true; - } - - /** - * Confirms authorization by sending authorization verification code. - * - * Has next restrictions: - * – 3 attempts per verification code. - */ - rpc confirmAuthorization(ConfirmAuthorizationRequest) returns (ConfirmAuthorizationRequest.Response) { - option (omit_authorization) = true; - } - - /** - * Renews authorization using refresh token. - * - * Returns: new [Authorization]. - */ - rpc renewAuthorization(RenewAuthorizationRequest) returns (RenewAuthorizationRequest.Response) { - option (omit_authorization) = true; - } - - /** - * Creates a user's profile if it's a new account. - */ - rpc createProfile(CreateProfileRequest) returns (CreateProfileRequest.Response) { - option (omit_authorization) = true; - } - - /** - * Gets all active authorizations. - */ - rpc getAuthorizations(GetAuthorizationsRequest) returns (GetAuthorizationsRequest.Response); - - /** - * Terminates authorization by given identifier. - * - * Returns [Status] - */ - rpc terminateAuthorization(google.protobuf.Empty) returns (google.protobuf.Empty); -} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/options/OmitAuthorizationOption.proto b/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/options/OmitAuthorizationOption.proto deleted file mode 100644 index a001e6b..0000000 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/options/OmitAuthorizationOption.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; - -import "google/protobuf/descriptor.proto"; - -option java_package = "org.timemates.api.authorizations.options"; - -extend google.protobuf.MethodOptions { - /** - * Some methods should not be checked on authorization as they provide - * registration / authentication features or just safe to be called by anyone. - */ - bool omit_authorization = 50001; -} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/ConfirmAuthorizationRequest.proto b/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/ConfirmAuthorizationRequest.proto deleted file mode 100644 index 8e153c2..0000000 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/ConfirmAuthorizationRequest.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -import "org/timemates/api/authorizations/types/Authorization.proto"; - -option java_package = "org.timemates.api.authorizations.requests"; - -message ConfirmAuthorizationRequest { - string verificationHash = 1; - string confirmationCode = 2; - - message Response { - bool isNewAccount = 1; - // if it's a new account, there's no authorization returned - optional Authorization authorization = 2; - } -} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/GetAuthorizationsRequest.proto b/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/GetAuthorizationsRequest.proto deleted file mode 100644 index 3ce0f7c..0000000 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/GetAuthorizationsRequest.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -import "org/timemates/api/authorizations/types/Authorization.proto"; - -option java_package = "org.timemates.api.authorizations.requests"; - -message GetAuthorizationsRequest { - // null if it's start of pagination - optional string pageToken = 1; - optional int32 pageSize = 2; - - message Response { - repeated Authorization authorizations = 1; - string nextPageToken = 2; - } -} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/StartAuthorizationRequest.proto b/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/StartAuthorizationRequest.proto deleted file mode 100644 index 576d198..0000000 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/StartAuthorizationRequest.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; - -import "org/timemates/api/authorizations/types/Authorization.proto"; -import "org/timemates/api/authorizations/types/Metadata.proto"; - -option java_package = "org.timemates.api.authorizations.requests"; - -message StartAuthorizationRequest { - string emailAddress = 1; - - optional Metadata metadata = 2; - - message Result { - string verificationHash = 1; - int64 expiresAt = 2; - int32 attempts = 3; - } -} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/TimersService.proto b/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/TimersService.proto deleted file mode 100644 index f6cbac9..0000000 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/TimersService.proto +++ /dev/null @@ -1,74 +0,0 @@ -syntax = "proto3"; - -import "org/timemates/api/timers/requests/CreateTimerRequest.proto"; -import "org/timemates/api/timers/requests/EditTimerInfoRequest.proto"; -import "org/timemates/api/timers/requests/RemoveTimerRequest.proto"; -import "org/timemates/api/timers/requests/GetTimerRequest.proto"; -import "org/timemates/api/timers/requests/GetTimersRequest.proto"; -import "org/timemates/api/timers/members/requests/KickMemberRequest.proto"; -import "org/timemates/api/timers/members/requests/GetMembersRequest.proto"; -import "org/timemates/api/timers/members/invites/requests/CreateInviteRequest.proto"; -import "org/timemates/api/timers/members/invites/requests/GetInvitesRequest.proto"; -import "org/timemates/api/timers/members/invites/requests/RemoveInviteRequest.proto"; -import "org/timemates/api/timers/members/invites/requests/JoinTimerByInviteCodeRequest.proto"; -import "org/timemates/api/timers/types/Timer.proto"; -import "google/protobuf/empty.proto"; - -option java_package = "org.timemates.api.timers"; - -service TimersService { - /** - * Creates timer. - */ - rpc createTimer(CreateTimerRequest) returns (CreateTimerRequest.Response); - - /** - * Gets timer by id. - */ - rpc getTimer(GetTimerRequest) returns (Timer); - - /* - * Gets timers by page token. - */ - rpc getTimers(GetTimersRequest) returns (GetTimersRequest.Response); - - /** - * Edits timer information & settings (name, description). - */ - rpc editTimer(EditTimerRequest) returns (google.protobuf.Empty); - - /** - * Kicks member out of timer. - */ - rpc kickMember(KickMemberRequest) returns (google.protobuf.Empty); - - /* - * Gets members of a timer. - */ - rpc getMembers(GetMembersRequest) returns (GetMembersRequest.Response); - - /* - * Creates invite for joining a timer. - */ - rpc createInvite(InviteMemberRequest) returns (InviteMemberRequest.Response); - - /** - * Gets invites of a timer. - */ - rpc getInvites(GetInvitesRequest) returns (GetInvitesRequest.Response); - - /** - * Gets invites of a timer. - */ - rpc removeInvite(RemoveInviteRequest) returns (google.protobuf.Empty); - - /** - * Joins timer by invite code. - */ - rpc joinByInvite(JoinTimerByInviteCodeRequest) returns (JoinTimerByInviteCodeRequest.Response); - - /** - * Removes timer. - */ - rpc removeTimer(RemoveTimerRequest) returns (google.protobuf.Empty); -} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/UsersService.proto b/infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/UsersService.proto deleted file mode 100644 index 392f9e3..0000000 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/UsersService.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; - -import "org/timemates/api/users/requests/GetUsersRequest.proto"; -import "org/timemates/api/users/requests/EditUserRequest.proto"; -import "org/timemates/api/users/requests/EditEmailRequest.proto"; -import "org/timemates/api/users/types/User.proto"; -import "google/protobuf/empty.proto"; - -option java_package = "org.timemates.api.users"; - -service UsersService { - /** - * Gets users by given identifiers. - * - * Returns [User] or null. - */ - rpc getUsers(GetUsersRequest) returns (Users); - - /** - * Sets user information (name / description / avatar file id). - * - * Returns [Status] - */ - rpc setUser(EditUserRequest) returns (google.protobuf.Empty); - - /** - * Sets new email for current user. - * - * Returns [Status] - */ - rpc setEmail(EditEmailRequest) returns (google.protobuf.Empty); -} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/CoreAuthService.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/CoreAuthService.proto new file mode 100644 index 0000000..c1d4425 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/CoreAuthService.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +import "/timemates/auth/core/requests/ObtainAuthRequest.proto"; +import "/timemates/auth/core/requests/GetAuthorizationsRequest.proto"; +import "/timemates/auth/core/requests/RenewAuthorizationRequest.proto"; +import "/timemates/auth/core/requests/LinkAuthMethodRequest.proto"; +import "/timemates/auth/core/types/Authorization.proto"; +import "google/protobuf/empty.proto"; + +option java_package = "org.timemates.api.auth.core"; + +// Core authentication service responsible for managing user authentication and authorizations. +service CoreAuthService { + // Retrieves the authentication status of the user. + // This method returns the authentication status of the user. + rpc ObtainAuth(ObtainAuthRequest) returns (ObtainAuthRequest.Response); + + // Links a new auth method / replaces existing with the given one that was used in the + // auth session. + rpc LinkAuthMethod(LinkAuthMethodRequest) returns (LinkAuthMethodRequest.Response); + + // Creates a new authorization from refresh token of old authorization that is expired + // or is about to be expired. + rpc RenewAuth(RenewAuthorizationRequest) returns (RenewAuthorizationRequest.Response); + + // Gets all active authorizations. + // This method retrieves all active authorizations. + rpc GetAuthList(GetAuthorizationsRequest) returns (GetAuthorizationsRequest.Response); + + // Terminates authorization by given identifier. + // This method terminates authorization by the given identifier. + // It returns an empty response upon successful termination. + rpc TerminateAuth(google.protobuf.Empty) returns (google.protobuf.Empty); +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/GetAuthorizationsRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/GetAuthorizationsRequest.proto new file mode 100644 index 0000000..87b16a3 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/GetAuthorizationsRequest.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +import "/timemates/auth/core/types/Authorization.proto"; +import "/timemates/auth/core/types/AuthorizationView.proto"; + + +option java_package = "org.timemates.api.auth.core.requests"; + +message GetAuthorizationsRequest { + // null if it's start of pagination + optional string pageToken = 1; + optional int32 pageSize = 2; + + message Response { + repeated AuthorizationView authorizations = 1; + string nextPageToken = 2; + } +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/LinkAuthMethodRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/LinkAuthMethodRequest.proto new file mode 100644 index 0000000..750fdcb --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/LinkAuthMethodRequest.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +import "/timemates/auth/core/types/Authorization.proto"; + +option java_package = "org.timemates.api.auth.core.requests"; + +message LinkAuthMethodRequest { + // Verification hash obtained in the corresponding service (TelegramAuthService, EmailAuthService) + string verificationHash = 1; + // Access hash of the authorized user that wants to link an auth method + string accessHash = 2; + + message Response { + Status status = 1; + + enum Status { + // Linking is successful, a new auth method is added or is replaced with. + SUCCESSFULLY_LINKED = 0; + // Linking is failed: given auth method is already linked to the another account. + ALREADY_LINKED = 1; + // Linking is failed: given auth method is + AUTH_IS_NOT_FINISHED = 2; + } + } +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/ObtainAuthRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/ObtainAuthRequest.proto new file mode 100644 index 0000000..fd5ecc2 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/ObtainAuthRequest.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +option java_package = "org.timemates.api.auth.core"; + +import "/timemates/auth/core/types/Authorization.proto"; + +message ObtainAuthRequest { + string verificationHash = 1; + + message Response { + oneof status { + Unfinished unfinished = 1; + Authorized authorized = 2; + Expired expired = 3; + } + + message Unfinished {} + message Authorized { + bool hasAccount = 1; + // Authorization is present if [hasAccount] is true. + // Otherwise, client should proceed to profile configuration to obtain authorization. + Authorization authorization = 2; + } + message Expired {} + } +} diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/RenewAuthorizationRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/RenewAuthorizationRequest.proto similarity index 52% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/RenewAuthorizationRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/RenewAuthorizationRequest.proto index 4c13cb8..e11066f 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/RenewAuthorizationRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/requests/RenewAuthorizationRequest.proto @@ -1,8 +1,8 @@ syntax = "proto3"; -import "org/timemates/api/authorizations/types/Authorization.proto"; +import "/timemates/auth/core/types/Authorization.proto"; -option java_package = "org.timemates.api.authorizations.requests"; +option java_package = "org.timemates.api.auth.requests"; message RenewAuthorizationRequest { string refreshHash = 1; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/types/Authorization.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/types/Authorization.proto similarity index 67% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/types/Authorization.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/auth/core/types/Authorization.proto index 46a5d92..7283dbb 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/types/Authorization.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/types/Authorization.proto @@ -1,8 +1,8 @@ syntax = "proto3"; -import "org/timemates/api/authorizations/types/Metadata.proto"; +import "/timemates/auth/core/types/Metadata.proto"; -option java_package = "org.timemates.api.authorizations.types"; +option java_package = "org.timemates.api.auth.core.types"; message Authorization { /** @@ -10,14 +10,14 @@ message Authorization { * * Has null if it's not new authorization. */ - optional Hash accessHash = 2; + Hash accessHash = 2; /** * Hash that used to identify user. * * Has null if it's not new authorization. */ - optional Hash refreshHash = 3; + Hash refreshHash = 3; /** * Denotes when authorization was generated. @@ -29,13 +29,20 @@ message Authorization { */ optional Metadata metadata = 5; + Method method = 6; + /** * Owner's id. */ - int64 userId = 6; + int64 userId = 7; message Hash { string value = 1; int64 expiresAt = 2; } + + enum Method { + EMAIL = 0; + TELEGRAM = 1; + } } \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/types/AuthorizationVIew.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/types/AuthorizationVIew.proto new file mode 100644 index 0000000..d6c5be9 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/types/AuthorizationVIew.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +import "/timemates/auth/core/types/Metadata.proto"; +import "/timemates/auth/core/types/Authorization.proto"; + +option java_package = "org.timemates.api.auth.core.types"; + +message AuthorizationView { + // Denotes unique identifier of authorization. + int64 authorizationId = 1; + + // When authorization was created. + int64 generationTime = 2; + + // Additional information about authorization. + optional Metadata metadata = 3; + + // Denotes method that was used to create authorization. + Authorization.Method method = 4; +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/types/Metadata.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/types/Metadata.proto similarity index 59% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/types/Metadata.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/auth/core/types/Metadata.proto index bfb0ecf..96c67a7 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/types/Metadata.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/core/types/Metadata.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option java_package = "org.timemates.api.authorizations.types"; +option java_package = "org.timemates.api.auth.types"; message Metadata { string clientName = 1; diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/EmailAuthService.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/EmailAuthService.proto new file mode 100644 index 0000000..eb44a99 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/EmailAuthService.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +option java_package = "org.timemates.api.auth.email"; + +import "/timemates/auth/email/requests/SendAuthCodeRequest.proto"; +import "/timemates/auth/email/requests/ConfirmAuthRequest.proto"; +import "/timemates/auth/email/requests/LinkEmailRequest.proto"; + + +// Service responsible for handling email-based authentication. +service EmailAuthService { + // Sends authentication code to the user's email. + // This method sends an authentication code to the user's email address + // for the purpose of authentication. + rpc Authorize(SendAuthCodeRequest) returns (SendAuthCodeRequest.Response); + + // Confirms authentication or method linking using the provided code. + // This method confirms the authentication using the code received by the user + // through email and returns the authentication result. + rpc Confirm(ConfirmAuthRequest) returns (ConfirmAuthRequest.Response); +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/ConfirmAuthRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/ConfirmAuthRequest.proto new file mode 100644 index 0000000..b6bfe14 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/ConfirmAuthRequest.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +option java_package = "org.timemates.api.auth.email.requests"; + +message ConfirmAuthRequest { + string verificationHash = 1; + string confirmationCode = 2; + + message Response { + Status status = 1; + + enum Status { + SUCCESS = 0; + INVALID_CODE = 1; + ATTEMPTS_EXCEED = 2; + } + } +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/ConfirmLinkingRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/ConfirmLinkingRequest.proto new file mode 100644 index 0000000..b941f34 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/ConfirmLinkingRequest.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +option java_package = "org.timemates.api.auth.email.requests"; + +message ConfirmLinkingRequest { + string verificationHash = 1; + string confirmationCode = 2; + + message Response { + Status status = 1; + + enum Status { + SUCCESS = 0; + INVALID_CODE = 1; + ATTEMPTS_EXCEED = 2; + } + } +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/LinkEmailRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/LinkEmailRequest.proto new file mode 100644 index 0000000..a271e60 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/LinkEmailRequest.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +option java_package = "org.timemates.api.auth.email.requests"; + +message LinkEmailRequest { + string emailAddress = 1; + string accessHash = 2; + + message Response { + string verificationHash = 1; + } +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/SendAuthCodeRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/SendAuthCodeRequest.proto new file mode 100644 index 0000000..d1adccf --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/email/requests/SendAuthCodeRequest.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +option java_package = "org.timemates.api.auth.email.requests"; + +message SendAuthCodeRequest { + string emailAddress = 1; + + message Response { + string verificationHash = 1; + } +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/TelegramAuthService.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/TelegramAuthService.proto new file mode 100644 index 0000000..50f4ea5 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/TelegramAuthService.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +option java_package = "org.timemates.api.auth.telegram"; + +import "google/protobuf/empty.proto"; +import "timemates/auth/telegram/requests/GetTgAuthLinkRequest.proto"; +import "timemates/auth/telegram/requests/WatchTelegramAuthRequest.proto"; +import "timemates/auth/telegram/requests/CompleteTgAuthRequest.proto"; +import "timemates/auth/telegram/requests/LinkTelegramAuthRequest.proto"; + + +// Service responsible for handling Telegram authentication. +service TelegramAuthService { + // Retrieves the authentication link for Telegram. Can be used both for linking an account + // and authentication. + rpc Authorize(google.protobuf.Empty) returns (GetTelegramAuthLinkRequest.Response); + + // Watches for authentication status on Telegram. + // + // This method watches for the authentication status of a user on Telegram + // by continuously checking if the user has completed the authentication process. + rpc Watch(WatchTelegramAuthRequest) returns (stream WatchTelegramAuthRequest.Response); + + // Internal Auth API that is used by bot. + rpc Complete(CompleteTgAuthRequest) returns (google.protobuf.Empty); +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/CompleteTgAuthRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/CompleteTgAuthRequest.proto new file mode 100644 index 0000000..e230a1c --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/CompleteTgAuthRequest.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +option java_package = "org.timemates.api.auth.telegram"; + +message CompleteTgAuthRequest { + string botSecretKey = 1; + string temporalHash = 2; +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/GetTgAuthLinkRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/GetTgAuthLinkRequest.proto new file mode 100644 index 0000000..a0f89f6 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/GetTgAuthLinkRequest.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +import "google/protobuf/timestamp.proto"; + +message GetTelegramAuthLinkRequest { + message Response { + string verificationHash = 1; + string telegramLink = 2; + } +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/LinkTelegramAuthRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/LinkTelegramAuthRequest.proto new file mode 100644 index 0000000..6ea3958 --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/LinkTelegramAuthRequest.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +import "google/protobuf/timestamp.proto"; + +message LinkTelegramAuthRequest { + string accessHash = 1; + + message Response { + string verificationHash = 1; + } +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/WatchTelegramAuthRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/WatchTelegramAuthRequest.proto new file mode 100644 index 0000000..1b7086a --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/auth/telegram/requests/WatchTelegramAuthRequest.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +message WatchTelegramAuthRequest { + string verificationHash = 1; + + message Response { + Status status = 1; + + enum Status { + SUCCESS = 0; + REQUIRES_PROFILE_SETUP = 1; + } + } +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/timers/TimersService.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/TimersService.proto new file mode 100644 index 0000000..d67c97b --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/TimersService.proto @@ -0,0 +1,74 @@ +syntax = "proto3"; + +import "/timemates/timers/requests/CreateTimerRequest.proto"; +import "/timemates/timers/requests/EditTimerInfoRequest.proto"; +import "/timemates/timers/requests/RemoveTimerRequest.proto"; +import "/timemates/timers/requests/GetTimerRequest.proto"; +import "/timemates/timers/requests/GetTimersRequest.proto"; +import "/timemates/timers/members/requests/KickMemberRequest.proto"; +import "/timemates/timers/members/requests/GetMembersRequest.proto"; +import "/timemates/timers/members/invites/requests/CreateInviteRequest.proto"; +import "/timemates/timers/members/invites/requests/GetInvitesRequest.proto"; +import "/timemates/timers/members/invites/requests/RemoveInviteRequest.proto"; +import "/timemates/timers/members/invites/requests/JoinTimerByInviteCodeRequest.proto"; +import "/timemates/timers/types/Timer.proto"; +import "google/protobuf/empty.proto"; + +option java_package = "org.timemates.api.timers"; + +service TimersService { + /** + * Creates timer. + */ + rpc CreateTimer(CreateTimerRequest) returns (CreateTimerRequest.Response); + + /** + * Gets timer by id. + */ + rpc GetTimer(GetTimerRequest) returns (Timer); + + /* + * Gets timers by page token. + */ + rpc GetTimers(GetTimersRequest) returns (GetTimersRequest.Response); + + /** + * Edits timer information & settings (name, description). + */ + rpc EditTimer(EditTimerRequest) returns (google.protobuf.Empty); + + /** + * Kicks member out of timer. + */ + rpc KickMember(KickMemberRequest) returns (google.protobuf.Empty); + + /* + * Gets members of a timer. + */ + rpc GetMembers(GetMembersRequest) returns (GetMembersRequest.Response); + + /* + * Creates invite for joining a timer. + */ + rpc CreateInvite(InviteMemberRequest) returns (InviteMemberRequest.Response); + + /** + * Gets invites of a timer. + */ + rpc GetInvites(GetInvitesRequest) returns (GetInvitesRequest.Response); + + /** + * Gets invites of a timer. + */ + rpc RemoveInvite(RemoveInviteRequest) returns (google.protobuf.Empty); + + /** + * Joins timer by invite code. + */ + rpc JoinByInvite(JoinTimerByInviteCodeRequest) returns (JoinTimerByInviteCodeRequest.Response); + + /** + * Removes timer. + */ + rpc RemoveTimer(RemoveTimerRequest) returns (google.protobuf.Empty); +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/CreateInviteRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/CreateInviteRequest.proto similarity index 81% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/CreateInviteRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/CreateInviteRequest.proto index 1f2617d..a311544 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/CreateInviteRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/CreateInviteRequest.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -import "org/timemates/api/users/types/User.proto"; +import "/timemates/users/types/User.proto"; option java_package = "org.timemates.api.timers.members.invites.requests"; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/GetInvitesRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/GetInvitesRequest.proto similarity index 81% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/GetInvitesRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/GetInvitesRequest.proto index 40946b0..dd0c051 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/GetInvitesRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/GetInvitesRequest.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -import "org/timemates/api/timers/members/invites/types/Invite.proto"; +import "/timemates/timers/members/invites/types/Invite.proto"; option java_package = "org.timemates.api.timers.members.invites.requests"; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/JoinTimerByInviteCodeRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/JoinTimerByInviteCodeRequest.proto similarity index 78% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/JoinTimerByInviteCodeRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/JoinTimerByInviteCodeRequest.proto index 63821c8..5f7fa7d 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/JoinTimerByInviteCodeRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/JoinTimerByInviteCodeRequest.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -import "org/timemates/api/timers/types/Timer.proto"; +import "/timemates/timers/types/Timer.proto"; option java_package = "org.timemates.api.timers.requests"; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/RemoveInviteRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/RemoveInviteRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/requests/RemoveInviteRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/requests/RemoveInviteRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/types/Invite.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/types/Invite.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/invites/types/Invite.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/members/invites/types/Invite.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/requests/GetMembersRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/requests/GetMembersRequest.proto similarity index 85% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/requests/GetMembersRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/members/requests/GetMembersRequest.proto index 465933a..ba449e5 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/requests/GetMembersRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/requests/GetMembersRequest.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -import "org/timemates/api/users/types/User.proto"; +import "/timemates/users/types/User.proto"; option java_package = "org.timemates.api.timers.members.requests"; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/requests/KickMemberRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/members/requests/KickMemberRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/members/requests/KickMemberRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/members/requests/KickMemberRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/CreateTimerRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/CreateTimerRequest.proto similarity index 87% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/CreateTimerRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/CreateTimerRequest.proto index 3539c97..3710ce9 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/CreateTimerRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/CreateTimerRequest.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -import "org/timemates/api/timers/types/Timer.proto"; +import "/timemates/timers/types/Timer.proto"; option java_package = "org.timemates.api.timers.requests"; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/EditTimerInfoRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/EditTimerInfoRequest.proto similarity index 87% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/EditTimerInfoRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/EditTimerInfoRequest.proto index 4cbe8a3..a7db231 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/EditTimerInfoRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/EditTimerInfoRequest.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -import "org/timemates/api/timers/types/Timer.proto"; +import "/timemates/timers/types/Timer.proto"; option java_package = "org.timemates.api.timers.requests"; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/GetTimerRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/GetTimerRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/GetTimerRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/GetTimerRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/GetTimersRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/GetTimersRequest.proto similarity index 83% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/GetTimersRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/GetTimersRequest.proto index 051efdc..25f9c5b 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/GetTimersRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/GetTimersRequest.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -import "org/timemates/api/timers/types/Timer.proto"; +import "/timemates/timers/types/Timer.proto"; option java_package = "org.timemates.api.timers.requests"; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/RemoveTimerRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/RemoveTimerRequest.proto similarity index 71% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/RemoveTimerRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/RemoveTimerRequest.proto index 6b73bb2..0812dda 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/requests/RemoveTimerRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/requests/RemoveTimerRequest.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -import "org/timemates/api/timers/types/Timer.proto"; +import "/timemates/timers/types/Timer.proto"; option java_package = "org.timemates.api.timers.requests"; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/TimerSessionsService.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/TimerSessionsService.proto similarity index 55% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/TimerSessionsService.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/TimerSessionsService.proto index 06a14c4..27699db 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/TimerSessionsService.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/TimerSessionsService.proto @@ -1,14 +1,14 @@ syntax = "proto3"; -import "org/timemates/api/timers/sessions/requests/StartTimerSessionRequest.proto"; -import "org/timemates/api/timers/sessions/requests/StopTimerSessionRequest.proto"; -import "org/timemates/api/timers/sessions/requests/JoinTimerSessionRequest.proto"; -import "org/timemates/api/timers/sessions/requests/ConfirmTimerSessionRequest.proto"; -import "org/timemates/api/timers/sessions/requests/GetTimerStateRequest.proto"; -import "org/timemates/api/timers/sessions/types/TimerState.proto"; +import "/timemates/timers/sessions/requests/StartTimerSessionRequest.proto"; +import "/timemates/timers/sessions/requests/StopTimerSessionRequest.proto"; +import "/timemates/timers/sessions/requests/JoinTimerSessionRequest.proto"; +import "/timemates/timers/sessions/requests/ConfirmTimerSessionRequest.proto"; +import "/timemates/timers/sessions/requests/GetTimerStateRequest.proto"; +import "/timemates/timers/sessions/types/TimerState.proto"; import "google/protobuf/empty.proto"; -import "org/timemates/api/timers/sessions/requests/GetCurrentTimerSessionRequest.proto"; -import "org/timemates/api/timers/types/Timer.proto"; +import "/timemates/timers/sessions/requests/GetCurrentTimerSessionRequest.proto"; +import "/timemates/timers/types/Timer.proto"; option java_package = "org.timemates.api.timers"; @@ -21,25 +21,25 @@ service TimerSessionsService { * Starts the timer session. * This RPC method starts the timer session. */ - rpc startTimer(StartTimerRequest) returns (google.protobuf.Empty); + rpc StartTimer(StartTimerRequest) returns (google.protobuf.Empty); /** * Stops the timer session. * This RPC method stops the timer session. */ - rpc stopTimer(StopTimerRequest) returns (google.protobuf.Empty); + rpc StopTimer(StopTimerRequest) returns (google.protobuf.Empty); /** * Joins the timer session. * This RPC method allows a user to join the timer session. */ - rpc joinSession(JoinTimerSessionRequest) returns (google.protobuf.Empty); + rpc JoinSession(JoinTimerSessionRequest) returns (google.protobuf.Empty); /** * Leaves the timer session. * This RPC method allows a user to leave the timer session. */ - rpc leaveSession(google.protobuf.Empty) returns (google.protobuf.Empty); + rpc LeaveSession(google.protobuf.Empty) returns (google.protobuf.Empty); /** * Confirms the user's attendance of the next round. @@ -49,23 +49,23 @@ service TimerSessionsService { * * Server will automatically determine your session. */ - rpc confirmRound(google.protobuf.Empty) returns (google.protobuf.Empty); + rpc ConfirmRound(google.protobuf.Empty) returns (google.protobuf.Empty); /** * Sends a ping request that says that client currently online and active. * Client should send such request once per 5 minutes. */ - rpc pingSession(google.protobuf.Empty) returns (google.protobuf.Empty); + rpc PingSession(google.protobuf.Empty) returns (google.protobuf.Empty); /** * Retrieves the current state of the timer. * This RPC method always returns the current state of the timer and then updates of it. * The state is returned as a stream of TimerState messages. */ - rpc getState(GetTimerStateRequest) returns (stream TimerState); + rpc GetState(GetTimerStateRequest) returns (stream TimerState); /** * Gets current timer session */ - rpc getCurrentTimerSession(google.protobuf.Empty) returns (Timer); + rpc GetCurrentTimerSession(google.protobuf.Empty) returns (Timer); } diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/ConfirmTimerSessionRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/ConfirmTimerSessionRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/ConfirmTimerSessionRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/ConfirmTimerSessionRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/GetCurrentTimerSessionRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/GetCurrentTimerSessionRequest.proto similarity index 76% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/GetCurrentTimerSessionRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/GetCurrentTimerSessionRequest.proto index 465e287..c4f2d19 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/GetCurrentTimerSessionRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/GetCurrentTimerSessionRequest.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -import "org/timemates/api/timers/types/Timer.proto"; +import "/timemates/timers/types/Timer.proto"; option java_package = "org.timemates.api.timers.requests"; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/GetTimerStateRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/GetTimerStateRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/GetTimerStateRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/GetTimerStateRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/JoinTimerSessionRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/JoinTimerSessionRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/JoinTimerSessionRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/JoinTimerSessionRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/StartTimerSessionRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/StartTimerSessionRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/StartTimerSessionRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/StartTimerSessionRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/StopTimerSessionRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/StopTimerSessionRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/requests/StopTimerSessionRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/requests/StopTimerSessionRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/types/TimerState.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/types/TimerState.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/sessions/types/TimerState.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/sessions/types/TimerState.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/types/Timer.proto b/infrastructure/rsocket-api/src/main/proto/timemates/timers/types/Timer.proto similarity index 97% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/types/Timer.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/timers/types/Timer.proto index 89ad05b..165b46d 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/timers/types/Timer.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/timers/types/Timer.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -import "org/timemates/api/timers/sessions/types/TimerState.proto"; +import "/timemates/timers/sessions/types/TimerState.proto"; option java_package = "org.timemates.api.timers.types"; diff --git a/infrastructure/rsocket-api/src/main/proto/timemates/users/UsersService.proto b/infrastructure/rsocket-api/src/main/proto/timemates/users/UsersService.proto new file mode 100644 index 0000000..d31f67e --- /dev/null +++ b/infrastructure/rsocket-api/src/main/proto/timemates/users/UsersService.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; + +import "/timemates/users/requests/GetUsersRequest.proto"; +import "/timemates/users/requests/EditUserRequest.proto"; +import "/timemates/users/requests/EditEmailRequest.proto"; +import "/timemates/users/requests/CreateProfileRequest.proto"; +import "/timemates/users/types/User.proto"; +import "google/protobuf/empty.proto"; + +option java_package = "org.timemates.api.users"; + +service UsersService { + // Configures the user profile. + // This method allows users to configure their profile information. + rpc ConfigureProfile(CreateProfileRequest) returns (CreateProfileRequest.Response); + + /** + * Gets users by given identifiers. + * + * Returns [User] or null. + */ + rpc GetUsers(GetUsersRequest) returns (Users); + + /** + * Sets user information (name / description / avatar file id). + * + * Returns [Status] + */ + rpc EditProfile(EditUserRequest) returns (google.protobuf.Empty); + + /** + * Sets new email for current user. + * + * Returns [Status] + */ + rpc SetEmail(EditEmailRequest) returns (google.protobuf.Empty); +} \ No newline at end of file diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/CreateProfileRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/users/requests/CreateProfileRequest.proto similarity index 73% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/CreateProfileRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/users/requests/CreateProfileRequest.proto index 7d693ea..3c86532 100644 --- a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/authorizations/requests/CreateProfileRequest.proto +++ b/infrastructure/rsocket-api/src/main/proto/timemates/users/requests/CreateProfileRequest.proto @@ -1,6 +1,7 @@ syntax = "proto3"; -import "org/timemates/api/authorizations/types/Authorization.proto"; +import "/timemates/auth/core/types/Authorization.proto"; +import "/timemates/users/requests/CreateProfileRequest.proto"; option java_package = "org.timemates.api.users.requests"; diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/requests/EditEmailRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/users/requests/EditEmailRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/requests/EditEmailRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/users/requests/EditEmailRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/requests/EditUserRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/users/requests/EditUserRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/requests/EditUserRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/users/requests/EditUserRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/requests/GetUsersRequest.proto b/infrastructure/rsocket-api/src/main/proto/timemates/users/requests/GetUsersRequest.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/requests/GetUsersRequest.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/users/requests/GetUsersRequest.proto diff --git a/infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/types/User.proto b/infrastructure/rsocket-api/src/main/proto/timemates/users/types/User.proto similarity index 100% rename from infrastructure/rsocket-api/src/main/proto/org/timemates/api/users/types/User.proto rename to infrastructure/rsocket-api/src/main/proto/timemates/users/types/User.proto