Skip to content

Commit

Permalink
Merge pull request #89 from mpiorowski/feat/redis
Browse files Browse the repository at this point in the history
feat/redis
  • Loading branch information
mpiorowski authored Mar 8, 2024
2 parents 7f5db87 + 18b248c commit 1224549
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 46 deletions.
13 changes: 5 additions & 8 deletions client/src/lib/proto/main.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
syntax = "proto3";

package proto;

option go_package = "rusve/proto";

import "users.proto";
import "profile.proto";
import "notes.proto";
Expand Down Expand Up @@ -33,11 +30,6 @@ message StripeUrlResponse {
string url = 1;
}

message NoteResponse {
Note note = 1;
Profile profile = 2;
}

service UsersService {
rpc CreateUser(Empty) returns (Id) {}
rpc Auth(Empty) returns (AuthResponse) {}
Expand All @@ -49,6 +41,11 @@ service UsersService {
rpc CreateStripePortal(Empty) returns (StripeUrlResponse) {}
}

message NoteResponse {
Note note = 1;
Profile profile = 2;
}

service NotesService {
rpc CountNotesByUserId(Empty) returns (Count) {}
rpc GetNotesByUserId(Page) returns (stream NoteResponse) {}
Expand Down
3 changes: 0 additions & 3 deletions client/src/lib/proto/notes.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
syntax = "proto3";

package proto;

option go_package = "rusve/proto";

message Note {
string id = 1;
string created = 2;
Expand Down
3 changes: 0 additions & 3 deletions client/src/lib/proto/profile.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
syntax = "proto3";

package proto;

option go_package = "sgsg/proto";

message Profile {
string id = 1;
string created = 2;
Expand Down
4 changes: 2 additions & 2 deletions client/src/lib/proto/proto/UserRole.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Original file: users.proto

export const UserRole = {
ROLE_UNSET: 0,
UNSET: 0,
USER: 1,
ADMIN: 2,
} as const;

export type UserRole =
| 'ROLE_UNSET'
| 'UNSET'
| 0
| 'USER'
| 1
Expand Down
5 changes: 1 addition & 4 deletions client/src/lib/proto/users.proto
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
syntax = "proto3";

package proto;

option go_package = "sgsg/proto";

enum UserRole {
ROLE_UNSET = 0;
UNSET = 0;
USER = 1;
ADMIN = 2;
}
Expand Down
3 changes: 0 additions & 3 deletions client/src/lib/proto/utils.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
syntax = "proto3";

package proto;

option go_package = "rusve/proto";

enum FileTarget {
FILE_UNSET = 0;
DOCUMENT = 1;
Expand Down
4 changes: 1 addition & 3 deletions client/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ export default {
},
},
},
plugins: [
require("@tailwindcss/forms"),
],
plugins: [require("@tailwindcss/forms")],
};
10 changes: 5 additions & 5 deletions docker-compose.app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ services:
target: dev
args:
ENV: development
COOKIE_DOMAIN: .127.0.0.1
PUBLIC_AUTH_URL: http://127.0.0.1:8090
COOKIE_DOMAIN: localhost
PUBLIC_AUTH_URL: http://localhost:8090
USERS_URI: service-users
UTILS_URI: service-utils
NOTES_URI: service-notes
Expand All @@ -33,8 +33,8 @@ services:
PORT: 443
RUST_LOG: info
DATABASE_URL: postgresql://?host=db-users&user=postgres&password=12345&dbname=users
CLIENT_URL: http://127.0.0.1:3000
AUTH_URL: http://127.0.0.1:8090
CLIENT_URL: http://localhost:3000
AUTH_URL: http://localhost:8090
USERS_URL: http://service-users:443
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
Expand All @@ -57,7 +57,7 @@ services:
RUST_LOG: info
DATABASE_URL: postgresql://?host=db-users&user=postgres&password=12345&dbname=users
JWT_SECRET: ${JWT_SECRET}
CLIENT_URL: http://127.0.0.1:3000
CLIENT_URL: http://localhost:3000
STRIPE_API_KEY: ${STRIPE_API_KEY}
STRIPE_PRICE_ID: ${STRIPE_PRICE_ID}

Expand Down
4 changes: 4 additions & 0 deletions proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ name = "proto"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "proto"
path = "proto.rs"

[dependencies]
tonic-build = "0.9.2"
4 changes: 2 additions & 2 deletions proto/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
2 changes: 1 addition & 1 deletion proto/users.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";
package proto;

enum UserRole {
ROLE_UNSET = 0;
UNSET = 0;
USER = 1;
ADMIN = 2;
}
Expand Down
6 changes: 3 additions & 3 deletions service-auth/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct User {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UserRole {
RoleUnset = 0,
Unset = 0,
User = 1,
Admin = 2,
}
Expand All @@ -42,15 +42,15 @@ impl UserRole {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
UserRole::RoleUnset => "ROLE_UNSET",
UserRole::Unset => "UNSET",
UserRole::User => "USER",
UserRole::Admin => "ADMIN",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ROLE_UNSET" => Some(Self::RoleUnset),
"UNSET" => Some(Self::Unset),
"USER" => Some(Self::User),
"ADMIN" => Some(Self::Admin),
_ => None,
Expand Down
6 changes: 3 additions & 3 deletions service-notes/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct User {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UserRole {
RoleUnset = 0,
Unset = 0,
User = 1,
Admin = 2,
}
Expand All @@ -42,15 +42,15 @@ impl UserRole {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
UserRole::RoleUnset => "ROLE_UNSET",
UserRole::Unset => "UNSET",
UserRole::User => "USER",
UserRole::Admin => "ADMIN",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ROLE_UNSET" => Some(Self::RoleUnset),
"UNSET" => Some(Self::Unset),
"USER" => Some(Self::User),
"ADMIN" => Some(Self::Admin),
_ => None,
Expand Down
6 changes: 3 additions & 3 deletions service-users/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct User {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UserRole {
RoleUnset = 0,
Unset = 0,
User = 1,
Admin = 2,
}
Expand All @@ -42,15 +42,15 @@ impl UserRole {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
UserRole::RoleUnset => "ROLE_UNSET",
UserRole::Unset => "UNSET",
UserRole::User => "USER",
UserRole::Admin => "ADMIN",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ROLE_UNSET" => Some(Self::RoleUnset),
"UNSET" => Some(Self::Unset),
"USER" => Some(Self::User),
"ADMIN" => Some(Self::Admin),
_ => None,
Expand Down
6 changes: 3 additions & 3 deletions service-utils/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct User {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UserRole {
RoleUnset = 0,
Unset = 0,
User = 1,
Admin = 2,
}
Expand All @@ -42,15 +42,15 @@ impl UserRole {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
UserRole::RoleUnset => "ROLE_UNSET",
UserRole::Unset => "UNSET",
UserRole::User => "USER",
UserRole::Admin => "ADMIN",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ROLE_UNSET" => Some(Self::RoleUnset),
"UNSET" => Some(Self::Unset),
"USER" => Some(Self::User),
"ADMIN" => Some(Self::Admin),
_ => None,
Expand Down

0 comments on commit 1224549

Please sign in to comment.