From 77a6e9b1a48142758183165b824e3cddbdc36340 Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Mon, 28 Jul 2025 13:13:40 -0500 Subject: [PATCH] Removed uncessary GraphQL files | Added README to auth service --- services/auth/README.md | 10 ++++++ services/auth/resolvers/authResolvers.ts | 26 -------------- services/auth/schema/schema.graphql | 44 ------------------------ 3 files changed, 10 insertions(+), 70 deletions(-) create mode 100644 services/auth/README.md delete mode 100644 services/auth/resolvers/authResolvers.ts delete mode 100644 services/auth/schema/schema.graphql diff --git a/services/auth/README.md b/services/auth/README.md new file mode 100644 index 0000000..e99bef7 --- /dev/null +++ b/services/auth/README.md @@ -0,0 +1,10 @@ +# Auth Service +This service handles user authentication and authorization using Ory Kratos and integrates with a REST API. + +## Technologies Used +- **Ory Kratos (self-hosted)**: Identity and user management system. +- **Express.js**: Web framework for building the REST API. +- **PostgreSQL**: Database for storing user data. +- **Docker**: Kratos, PostgreSQL, and this service are containerized for easy deployment. + +Kratos was chosen for its robust identity management capabilities, including support for multiple authentication methods and self-service flows. It also provides first class support for PostgreSQL, which was my preferred database choice for this project. \ No newline at end of file diff --git a/services/auth/resolvers/authResolvers.ts b/services/auth/resolvers/authResolvers.ts deleted file mode 100644 index bce6741..0000000 --- a/services/auth/resolvers/authResolvers.ts +++ /dev/null @@ -1,26 +0,0 @@ - -type userLoginInput = { - email: String! - password: String! -} - - -const resolvers = { - Mutation: { - login: async (_parent, { input: input }, context) => { - const { email, password } = input; - // Db connection and authentication logic here - const user = await context.db.users.findOne({ email }); - if (!user || user.password !== password || !user.email) { - return { userLoginSuccessStatus: false }; - else if (user && user.password === password && user.email) { - return { userLoginSuccessStatus: true }; - } - else { - return { userLoginSuccessStatus: false }; - console.log("User not found or unknown error"); - } - }, - - } - } \ No newline at end of file diff --git a/services/auth/schema/schema.graphql b/services/auth/schema/schema.graphql deleted file mode 100644 index dd66c7d..0000000 --- a/services/auth/schema/schema.graphql +++ /dev/null @@ -1,44 +0,0 @@ -input UserLoginInput { - email: String! - password: String! -} - -type User { - id: ID! - firstName: String! - lastName: String! - email: String! - dateOfBirth: String! -} - -type UserLoginResponse { - success: Boolean! - token: String - user: User - error: String -} - -input CreateUserInput { - firstName: String! - lastName: String! - email: String! - password: String! - dateOfBirth: String! -} - -type CreateUserResponse { - success: Boolean! - token: String - user: User - error: String -} - -type UserLogoutResponse { - success: Boolean! -} - -type Mutation { - login(input: UserLoginInput!): UserLoginResponse! - logout: UserLogoutResponse! - createUser(input: CreateUserInput!): CreateUserResponse! -}