diff --git a/Cargo.lock b/Cargo.lock index a97db0a..78e7f89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -332,36 +332,6 @@ dependencies = [ "libc", ] -[[package]] -name = "api" -version = "0.1.0" -dependencies = [ - "actix", - "actix-rt", - "actix-threadpool", - "actix-web", - "actix-web-actors", - "argon2", - "async-trait", - "chrono", - "diesel", - "diesel_migrations", - "futures", - "jsonwebtoken", - "log", - "mockall", - "rand", - "rdkafka", - "rstest", - "serde", - "serde_json", - "tokio", - "tokio-postgres", - "utils", - "uuid", - "validator", -] - [[package]] name = "argon2" version = "0.5.2" @@ -2647,6 +2617,36 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "users" +version = "0.1.0" +dependencies = [ + "actix", + "actix-rt", + "actix-threadpool", + "actix-web", + "actix-web-actors", + "argon2", + "async-trait", + "chrono", + "diesel", + "diesel_migrations", + "futures", + "jsonwebtoken", + "log", + "mockall", + "rand", + "rdkafka", + "rstest", + "serde", + "serde_json", + "tokio", + "tokio-postgres", + "utils", + "uuid", + "validator", +] + [[package]] name = "utils" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 4f92928..c6bbd90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = [ - "api", + "users", "consumer", "utils", "news" diff --git a/Makefile b/Makefile index a06e320..5b05d31 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,11 @@ test: build-prod: - docker build -t ffff/rust-api-prod -f ./docker.prod/Dockerfile.api . + docker build -t ffff/rust-users-prod -f ./docker.prod/Dockerfile.users . + docker build -t ffff/rust-news-prod -f ./docker.prod/Dockerfile.news . docker build -t ffff/rust-fe-prod -f ./docker.prod/Dockerfile.fe . - docker build -t ffff/rust-migrations-prod -f ./docker.prod/Dockerfile.migrations . + docker build -t ffff/rust-users-migrations-prod -f ./docker.prod/Dockerfile.users-migrations . + docker build -t ffff/rust-news-migrations-prod -f ./docker.prod/Dockerfile.news-migrations . docker build -t ffff/rust-consumer-prod -f ./docker.prod/Dockerfile.consumer . deploy-k8s: diff --git a/docker-compose.yaml b/docker-compose.yaml index 6302cdb..cd5aaa6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -55,22 +55,22 @@ services: volumes: - ./data/kafka:/var/lib/kafka/data - api: + users: build: context: . - dockerfile: ./api/Dockerfile.dev + dockerfile: ./users/Dockerfile.dev ports: - 8000:8000 volumes: - - ./api/src:/app/api/src + - ./users/src:/app/users/src - ./utils/src:/app/utils/src - - ./logs/api:/var/log/app + - ./logs/users:/var/log/app environment: CORS_ORIGIN: http://localhost:3000 DATABASE_URL: "postgres://myuser:mypassword@postgres:5432/mydb?options=-c%20search_path%3Dusers" JWT_EXPIRED_IN: 60 JWT_MAX_AGE: 3600 - JWT_SECRET: api-secret-1234 + JWT_SECRET: users-secret-1234 KAFKA_URL: kafka:29092 LOGS_PATH: /var/log/app/stdout.log PORT: 8000 @@ -80,12 +80,12 @@ services: condition: service_healthy kafka: condition: service_healthy - api-migrations: + users-migrations: condition: service_completed_successfully - api-migrations: + users-migrations: build: - context: ./api + context: ./users dockerfile: Dockerfile.migrations environment: RUST_LOG: info @@ -156,5 +156,5 @@ services: ports: - 3000:3000 depends_on: - - api + - users - news diff --git a/docker.prod/Dockerfile.news b/docker.prod/Dockerfile.news new file mode 100644 index 0000000..85af7ab --- /dev/null +++ b/docker.prod/Dockerfile.news @@ -0,0 +1,56 @@ +ARG RUST_VERSION=1.72.0 +ARG APP_NAME=news +FROM rust:${RUST_VERSION}-slim-bullseye AS build +ARG APP_NAME +WORKDIR /app + +# dependencies to compile the Kafka client +RUN apt-get update && apt-get install -y build-essential \ + curl \ + openssl libssl-dev \ + pkg-config \ + python \ + valgrind \ + zlib1g-dev + +# dependencies to compile diesel client +RUN apt-get install -y \ + libpq-dev + +RUN echo "[workspace]\n\ + members = [\n\ + \"news\",\n\ + \"utils\"\n\ + ]" > ./Cargo.toml + +COPY ./news/Cargo.toml ./news/ +COPY ./utils/Cargo.toml ./utils/ + +RUN mkdir news/src +RUN echo "fn main() {}" > ./news/src/main.rs + +RUN mkdir utils/src +RUN echo "fn main() {}" > ./utils/src/main.rs + +RUN cargo build --release + +COPY ./utils/src ./utils/src +COPY ./news/src ./news/src + +RUN cargo build --release + +RUN cp ./target/release/$APP_NAME /bin/server + + +FROM debian:bullseye-slim AS final + +RUN apt-get update && apt-get install -y \ + libpq-dev \ + openssl libssl-dev \ + ca-certificates + +COPY --from=build /bin/server /bin/ + +EXPOSE 8001 + +CMD ["/bin/server"] diff --git a/docker.prod/Dockerfile.migrations b/docker.prod/Dockerfile.news-migrations similarity index 82% rename from docker.prod/Dockerfile.migrations rename to docker.prod/Dockerfile.news-migrations index 81e659e..15e333e 100644 --- a/docker.prod/Dockerfile.migrations +++ b/docker.prod/Dockerfile.news-migrations @@ -1,5 +1,5 @@ ARG RUST_VERSION=1.72.0 -ARG APP_NAME=api +ARG APP_NAME=news FROM rust:${RUST_VERSION}-slim-bullseye AS build ARG APP_NAME WORKDIR /app @@ -9,6 +9,6 @@ RUN apt-get update && apt-get install -y \ RUN cargo install diesel_cli --no-default-features --features postgres -COPY ./api/migrations /app/migrations +COPY ./news/migrations /app/migrations CMD ["diesel","migration","run"] diff --git a/docker.prod/Dockerfile.api b/docker.prod/Dockerfile.users similarity index 82% rename from docker.prod/Dockerfile.api rename to docker.prod/Dockerfile.users index d3868e4..b14c567 100644 --- a/docker.prod/Dockerfile.api +++ b/docker.prod/Dockerfile.users @@ -1,5 +1,5 @@ ARG RUST_VERSION=1.72.0 -ARG APP_NAME=api +ARG APP_NAME=users FROM rust:${RUST_VERSION}-slim-bullseye AS build ARG APP_NAME WORKDIR /app @@ -19,15 +19,15 @@ RUN apt-get install -y \ RUN echo "[workspace]\n\ members = [\n\ - \"api\",\n\ + \"users\",\n\ \"utils\"\n\ ]" > ./Cargo.toml -COPY ./api/Cargo.toml ./api/Cargo.lock ./api/ +COPY ./users/Cargo.toml ./users/Cargo.lock ./users/ COPY ./utils/Cargo.toml ./utils/ -RUN mkdir api/src -RUN echo "fn main() {}" > ./api/src/main.rs +RUN mkdir users/src +RUN echo "fn main() {}" > ./users/src/main.rs RUN mkdir utils/src RUN echo "fn main() {}" > ./utils/src/main.rs @@ -35,7 +35,7 @@ RUN echo "fn main() {}" > ./utils/src/main.rs RUN cargo build --release COPY ./utils/src ./utils/src -COPY ./api/src ./api/src +COPY ./users/src ./users/src RUN cargo build --release diff --git a/docker.prod/Dockerfile.users-migrations b/docker.prod/Dockerfile.users-migrations new file mode 100644 index 0000000..5e00df7 --- /dev/null +++ b/docker.prod/Dockerfile.users-migrations @@ -0,0 +1,14 @@ +ARG RUST_VERSION=1.72.0 +ARG APP_NAME=users +FROM rust:${RUST_VERSION}-slim-bullseye AS build +ARG APP_NAME +WORKDIR /app + +RUN apt-get update && apt-get install -y \ + libpq-dev + +RUN cargo install diesel_cli --no-default-features --features postgres + +COPY ./users/migrations /app/migrations + +CMD ["diesel","migration","run"] diff --git a/frontend/src/setupProxy.js b/frontend/src/setupProxy.js index 2d1f37a..674335f 100644 --- a/frontend/src/setupProxy.js +++ b/frontend/src/setupProxy.js @@ -35,7 +35,7 @@ module.exports = function (app) { .use( '/api/auth', createProxyMiddleware({ - target: 'http://api:8000', + target: 'http://users:8000', changeOrigin: true, pathRewrite: { '^/api/': '/', @@ -45,7 +45,7 @@ module.exports = function (app) { .use( '/ws', createProxyMiddleware({ - target: 'ws://api:8000', + target: 'ws://users:8000', changeOrigin: true, }) ); diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index b67b86f..2bd80c0 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -4,35 +4,63 @@ metadata: name: api-ingress annotations: nginx.ingress.kubernetes.io/use-regex: 'true' - nginx.ingress.kubernetes.io/rewrite-target: /$2 + nginx.ingress.kubernetes.io/rewrite-target: /$1$2 spec: rules: - host: rust-xp.com http: paths: - - path: /()(.*) + - path: /api/(feeds)(/|.*)? pathType: ImplementationSpecific backend: service: - name: fe-service + name: news-service port: - number: 80 - - path: /api(/|$)(.*) + number: 8001 + - path: /api/(news)(/|.*)? + pathType: ImplementationSpecific + backend: + service: + name: news-service + port: + number: 8001 + - path: /api/(users)(/|.*)? pathType: ImplementationSpecific backend: service: - name: api-service + name: users-service port: number: 8000 + - path: /api/(auth)(/.*) + pathType: ImplementationSpecific + backend: + service: + name: users-service + port: + number: 8000 + - path: /()(ws) + pathType: ImplementationSpecific + backend: + service: + name: users-service + port: + number: 8000 + - path: /()(.*) + pathType: ImplementationSpecific + backend: + service: + name: fe-service + port: + number: 80 ingressClassName: nginx --- apiVersion: v1 kind: Service metadata: - name: api-service + name: users-service spec: selector: - app: api + app: users ports: - protocol: TCP port: 8000 @@ -41,28 +69,28 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: - name: api-deployment + name: users-deployment spec: replicas: 1 selector: matchLabels: - app: api + app: users template: metadata: labels: - app: api + app: users spec: containers: - - name: api-container - image: ffff/rust-api-prod + - name: users-container + image: ffff/rust-users-prod imagePullPolicy: IfNotPresent ports: - containerPort: 8000 env: - name: CORS_ORIGIN - value: 'http://localhost:3000' + value: 'http://rust-xp.com' - name: DATABASE_URL - value: 'postgres://myuser:mypassword@postgres-service:5432/mydb' + value: 'postgres://myuser:mypassword@postgres-service:5432/mydb?options=-c%20search_path%3Dusers' - name: JWT_EXPIRED_IN value: '60' - name: JWT_MAX_AGE @@ -78,6 +106,52 @@ spec: --- apiVersion: v1 kind: Service +metadata: + name: news-service +spec: + selector: + app: news + ports: + - protocol: TCP + port: 8001 + targetPort: 8001 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: news-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: news + template: + metadata: + labels: + app: news + spec: + containers: + - name: news-container + image: ffff/rust-news-prod + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8001 + env: + - name: CORS_ORIGIN + value: 'http://rust-xp.com' + - name: DATABASE_URL + value: 'postgres://myuser:mypassword@postgres-service:5432/mydb?options=-c%20search_path%3Dnews' + - name: JWT_SECRET + value: 'api-secret-1234' + - name: KAFKA_URL + value: 'kafka-service:9092' + - name: PORT + value: '8001' + - name: RUST_LOG + value: 'debug' +--- +apiVersion: v1 +kind: Service metadata: name: fe-service spec: diff --git a/k8s/migrations.yaml b/k8s/migrations.yaml index 249fc0f..fe4ab33 100644 --- a/k8s/migrations.yaml +++ b/k8s/migrations.yaml @@ -1,17 +1,35 @@ apiVersion: batch/v1 kind: Job metadata: - name: migrations + name: users-migrations spec: template: metadata: - name: migrations + name: users-migrations spec: containers: - - name: migrations-container - image: ffff/rust-migrations-prod + - name: users-migrations-container + image: ffff/rust-users-migrations-prod imagePullPolicy: IfNotPresent env: - name: DATABASE_URL - value: 'postgres://myuser:mypassword@postgres-service:5432/mydb' + value: 'postgres://myuser:mypassword@postgres-service:5432/mydb?options=-c%20search_path%3Dusers' + restartPolicy: Never +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: news-migrations +spec: + template: + metadata: + name: news-migrations + spec: + containers: + - name: news-migrations-container + image: ffff/rust-news-migrations-prod + imagePullPolicy: IfNotPresent + env: + - name: DATABASE_URL + value: 'postgres://myuser:mypassword@postgres-service:5432/mydb?options=-c%20search_path%3Dnews' restartPolicy: Never diff --git a/k8s/postgres.yaml b/k8s/postgres.yaml index 9f9d776..e7fa6da 100644 --- a/k8s/postgres.yaml +++ b/k8s/postgres.yaml @@ -6,6 +6,7 @@ metadata: spec: selector: app: postgres + type: LoadBalancer ports: - name: postgres port: 5432 @@ -37,5 +38,13 @@ spec: value: 'mypassword' - name: POSTGRES_DB value: 'mydb' + volumeMounts: + - name: init-scripts-volume + mountPath: /docker-entrypoint-initdb.d + volumes: + - name: init-scripts-volume + hostPath: + path: /Users/fabioferreira/Projects/rust-noob/db-init-scripts + type: Directory --- diff --git a/news/src/scrapper.rs b/news/src/scrapper.rs index d21549a..926e5f9 100644 --- a/news/src/scrapper.rs +++ b/news/src/scrapper.rs @@ -116,7 +116,9 @@ impl Scrapper { } async fn scrap(rss_feed: &RssFeed) -> Result { - let xml = http_request(rss_feed.url.clone()).await.unwrap(); + let xml = http_request(rss_feed.url.clone()) + .await + .expect("Failed to send request"); let feed = parser::parse(xml.reader()).unwrap(); diff --git a/api/.gitignore b/users/.gitignore similarity index 100% rename from api/.gitignore rename to users/.gitignore diff --git a/api/Cargo.lock b/users/Cargo.lock similarity index 100% rename from api/Cargo.lock rename to users/Cargo.lock diff --git a/api/Cargo.toml b/users/Cargo.toml similarity index 98% rename from api/Cargo.toml rename to users/Cargo.toml index 9da8070..2641bb0 100644 --- a/api/Cargo.toml +++ b/users/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "api" +name = "users" version = "0.1.0" edition = "2021" diff --git a/api/Dockerfile.dev b/users/Dockerfile.dev similarity index 97% rename from api/Dockerfile.dev rename to users/Dockerfile.dev index 4e5d925..72cd799 100644 --- a/api/Dockerfile.dev +++ b/users/Dockerfile.dev @@ -1,5 +1,5 @@ ARG RUST_VERSION=1.72.0 -ARG APP_NAME=api +ARG APP_NAME=users FROM rust:${RUST_VERSION}-slim-bullseye AS build ARG APP_NAME WORKDIR /app diff --git a/api/Dockerfile.migrations b/users/Dockerfile.migrations similarity index 94% rename from api/Dockerfile.migrations rename to users/Dockerfile.migrations index 196af00..0b20b74 100644 --- a/api/Dockerfile.migrations +++ b/users/Dockerfile.migrations @@ -1,5 +1,5 @@ ARG RUST_VERSION=1.72.0 -ARG APP_NAME=news +ARG APP_NAME=users FROM rust:${RUST_VERSION}-slim-bullseye AS build ARG APP_NAME WORKDIR /app diff --git a/api/Makefile b/users/Makefile similarity index 100% rename from api/Makefile rename to users/Makefile diff --git a/api/diesel.toml b/users/diesel.toml similarity index 100% rename from api/diesel.toml rename to users/diesel.toml diff --git a/api/migrations/.keep b/users/migrations/.keep similarity index 100% rename from api/migrations/.keep rename to users/migrations/.keep diff --git a/api/migrations/2023-09-03-080958_create_users_table/down.sql b/users/migrations/2023-09-03-080958_create_users_table/down.sql similarity index 100% rename from api/migrations/2023-09-03-080958_create_users_table/down.sql rename to users/migrations/2023-09-03-080958_create_users_table/down.sql diff --git a/api/migrations/2023-09-03-080958_create_users_table/up.sql b/users/migrations/2023-09-03-080958_create_users_table/up.sql similarity index 100% rename from api/migrations/2023-09-03-080958_create_users_table/up.sql rename to users/migrations/2023-09-03-080958_create_users_table/up.sql diff --git a/api/migrations/2023-09-05-083304_add_password_to_users/down.sql b/users/migrations/2023-09-05-083304_add_password_to_users/down.sql similarity index 100% rename from api/migrations/2023-09-05-083304_add_password_to_users/down.sql rename to users/migrations/2023-09-05-083304_add_password_to_users/down.sql diff --git a/api/migrations/2023-09-05-083304_add_password_to_users/up.sql b/users/migrations/2023-09-05-083304_add_password_to_users/up.sql similarity index 100% rename from api/migrations/2023-09-05-083304_add_password_to_users/up.sql rename to users/migrations/2023-09-05-083304_add_password_to_users/up.sql diff --git a/api/migrations/2023-09-05-091229_add_name_unique_to_user/down.sql b/users/migrations/2023-09-05-091229_add_name_unique_to_user/down.sql similarity index 100% rename from api/migrations/2023-09-05-091229_add_name_unique_to_user/down.sql rename to users/migrations/2023-09-05-091229_add_name_unique_to_user/down.sql diff --git a/api/migrations/2023-09-05-091229_add_name_unique_to_user/up.sql b/users/migrations/2023-09-05-091229_add_name_unique_to_user/up.sql similarity index 100% rename from api/migrations/2023-09-05-091229_add_name_unique_to_user/up.sql rename to users/migrations/2023-09-05-091229_add_name_unique_to_user/up.sql diff --git a/api/postman.json b/users/postman.json similarity index 100% rename from api/postman.json rename to users/postman.json diff --git a/api/src/actors/mod.rs b/users/src/actors/mod.rs similarity index 100% rename from api/src/actors/mod.rs rename to users/src/actors/mod.rs diff --git a/api/src/actors/ws_server.rs b/users/src/actors/ws_server.rs similarity index 100% rename from api/src/actors/ws_server.rs rename to users/src/actors/ws_server.rs diff --git a/api/src/actors/ws_session.rs b/users/src/actors/ws_session.rs similarity index 100% rename from api/src/actors/ws_session.rs rename to users/src/actors/ws_session.rs diff --git a/api/src/app.rs b/users/src/app.rs similarity index 100% rename from api/src/app.rs rename to users/src/app.rs diff --git a/api/src/config.rs b/users/src/config.rs similarity index 100% rename from api/src/config.rs rename to users/src/config.rs diff --git a/api/src/error.rs b/users/src/error.rs similarity index 100% rename from api/src/error.rs rename to users/src/error.rs diff --git a/api/src/handlers/auth.rs b/users/src/handlers/auth.rs similarity index 100% rename from api/src/handlers/auth.rs rename to users/src/handlers/auth.rs diff --git a/api/src/handlers/health.rs b/users/src/handlers/health.rs similarity index 100% rename from api/src/handlers/health.rs rename to users/src/handlers/health.rs diff --git a/api/src/handlers/index.rs b/users/src/handlers/index.rs similarity index 100% rename from api/src/handlers/index.rs rename to users/src/handlers/index.rs diff --git a/api/src/handlers/message.rs b/users/src/handlers/message.rs similarity index 100% rename from api/src/handlers/message.rs rename to users/src/handlers/message.rs diff --git a/api/src/handlers/mod.rs b/users/src/handlers/mod.rs similarity index 100% rename from api/src/handlers/mod.rs rename to users/src/handlers/mod.rs diff --git a/api/src/handlers/user.rs b/users/src/handlers/user.rs similarity index 100% rename from api/src/handlers/user.rs rename to users/src/handlers/user.rs diff --git a/api/src/handlers/ws.rs b/users/src/handlers/ws.rs similarity index 100% rename from api/src/handlers/ws.rs rename to users/src/handlers/ws.rs diff --git a/api/src/lib.rs b/users/src/lib.rs similarity index 100% rename from api/src/lib.rs rename to users/src/lib.rs diff --git a/api/src/main.rs b/users/src/main.rs similarity index 92% rename from api/src/main.rs rename to users/src/main.rs index 2c66679..1a20be9 100644 --- a/api/src/main.rs +++ b/users/src/main.rs @@ -2,10 +2,10 @@ extern crate log; use actix_web::HttpServer; -use api::app; +use users::app; +use users::config::Config; use utils::logger::init_logger; -use api::config::Config; #[actix_web::main] async fn main() -> std::io::Result<()> { diff --git a/api/src/middlewares/jwt_auth.rs b/users/src/middlewares/jwt_auth.rs similarity index 100% rename from api/src/middlewares/jwt_auth.rs rename to users/src/middlewares/jwt_auth.rs diff --git a/api/src/middlewares/mod.rs b/users/src/middlewares/mod.rs similarity index 100% rename from api/src/middlewares/mod.rs rename to users/src/middlewares/mod.rs diff --git a/api/src/models/mod.rs b/users/src/models/mod.rs similarity index 100% rename from api/src/models/mod.rs rename to users/src/models/mod.rs diff --git a/api/src/models/token_claims.rs b/users/src/models/token_claims.rs similarity index 100% rename from api/src/models/token_claims.rs rename to users/src/models/token_claims.rs diff --git a/api/src/models/user.rs b/users/src/models/user.rs similarity index 100% rename from api/src/models/user.rs rename to users/src/models/user.rs diff --git a/api/src/repositories/mod.rs b/users/src/repositories/mod.rs similarity index 100% rename from api/src/repositories/mod.rs rename to users/src/repositories/mod.rs diff --git a/api/src/repositories/user_repository.rs b/users/src/repositories/user_repository.rs similarity index 100% rename from api/src/repositories/user_repository.rs rename to users/src/repositories/user_repository.rs diff --git a/api/src/schema.rs b/users/src/schema.rs similarity index 100% rename from api/src/schema.rs rename to users/src/schema.rs diff --git a/api/src/services/event_service.rs b/users/src/services/event_service.rs similarity index 100% rename from api/src/services/event_service.rs rename to users/src/services/event_service.rs diff --git a/api/src/services/mod.rs b/users/src/services/mod.rs similarity index 100% rename from api/src/services/mod.rs rename to users/src/services/mod.rs diff --git a/api/src/services/user_service.rs b/users/src/services/user_service.rs similarity index 100% rename from api/src/services/user_service.rs rename to users/src/services/user_service.rs diff --git a/api/tests/handlers/mod.rs b/users/tests/handlers/mod.rs similarity index 100% rename from api/tests/handlers/mod.rs rename to users/tests/handlers/mod.rs diff --git a/api/tests/handlers/user_test.rs b/users/tests/handlers/user_test.rs similarity index 96% rename from api/tests/handlers/user_test.rs rename to users/tests/handlers/user_test.rs index 2a5b357..8375a1a 100644 --- a/api/tests/handlers/user_test.rs +++ b/users/tests/handlers/user_test.rs @@ -1,10 +1,10 @@ use actix_web::http::StatusCode; use actix_web::test; -use api::app::setup_app; -use api::config::Config; -use api::handlers::user::CreateUserPayload; use serde::Deserialize; use serde_json::from_slice; +use users::app::setup_app; +use users::config::Config; +use users::handlers::user::CreateUserPayload; #[derive(Debug, Deserialize, PartialEq, Clone)] struct UserResponse { diff --git a/api/tests/repositories/mod.rs b/users/tests/repositories/mod.rs similarity index 100% rename from api/tests/repositories/mod.rs rename to users/tests/repositories/mod.rs diff --git a/api/tests/repositories/user_repository_test.rs b/users/tests/repositories/user_repository_test.rs similarity index 99% rename from api/tests/repositories/user_repository_test.rs rename to users/tests/repositories/user_repository_test.rs index 7197b69..60515c0 100644 --- a/api/tests/repositories/user_repository_test.rs +++ b/users/tests/repositories/user_repository_test.rs @@ -1,10 +1,10 @@ use std::sync::Arc; -use api::{ +use diesel::connection::SimpleConnection; +use users::{ config::Config, repositories::user_repository::{UserDieselRepository, UserRepository}, }; -use diesel::connection::SimpleConnection; use utils::db; use uuid::Uuid; diff --git a/api/tests/test.rs b/users/tests/test.rs similarity index 100% rename from api/tests/test.rs rename to users/tests/test.rs