Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript GraphQL resolvers and update Fastify server configuration #25

Merged
merged 36 commits into from
Jan 12, 2024

Commits on Jan 2, 2024

  1. Update several components and backend setup

    Several frontend components were updated to fix minor spelling issues and import order. The backend node script has been updated to use TypeScript files instead of JavaScript. The backend package.json has been updated with newer dependencies and included build script. Some string literals were also changed in the backend server to lower case.
    claygorman committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    85fef0f View commit details
    Browse the repository at this point in the history
  2. Update Docker and package configurations for TypeScript

    This update focuses on enhancing TypeScript compatibility by introducing a new dev dependency "ts-node" for better TypeScript runtime support. The "type" field is added to package.json making the project a module, and a new command "dev:ts" has been added to allow running the project using ts-node. A "built" exception is placed in .dockerignore. Command for running the development server inside Docker was adjusted accordingly.
    claygorman committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    8fc0684 View commit details
    Browse the repository at this point in the history
  3. Update build configuration and ignore files

    Updated Docker and ignore files to better handle typescript build files, and switched to SWC for faster compilation. The changes include updating the output directory from 'built' to 'dist', adding SWC as a dev dependency, and adding 'dist' to the list of docker ignored paths.
    claygorman committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    a5d79a9 View commit details
    Browse the repository at this point in the history
  4. Delete all database migration files

    This commit completely removes all database migration files in the backend/src/db/migrations directory. The files include migrations for creating tables such as "projects", "users", "boards", "issue_statuses", and more. It seems like some foundational changes are planned for the structure of the backend database necessitating the removal of all these migrations.
    claygorman committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    c1461f0 View commit details
    Browse the repository at this point in the history
  5. Updating .gitignore

    claygorman committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    fec0c22 View commit details
    Browse the repository at this point in the history
  6. Update backend configurations and fix issues in various files

    This commit includes several updates across multiple files for the backend, including revising import paths, updating build and execution scripts, and refining TypeScript configuration. The primary focus has been improving compatibility between files and making sure necessary configurations are appropriately updated.
    claygorman committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    fb9b2cf View commit details
    Browse the repository at this point in the history

Commits on Jan 3, 2024

  1. Delete all database migration files

    This commit completely removes all database migration files in the backend/src/db/migrations directory. The files include migrations for creating tables such as "projects", "users", "boards", "issue_statuses", and more. It seems like some foundational changes are planned for the structure of the backend database necessitating the removal of all these migrations.
    claygorman committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    7d130f7 View commit details
    Browse the repository at this point in the history
  2. Refactor backend code and remove docker-compose-clay.yml

    The `docker-compose-clay.yml` file was removed as it's no longer needed. The backend code on `index.ts` was refactored, moving several interface definitions to a new typings file at `backend/src/typings/index.ts`. A minor adjustment was also made to handling multipart requests. A `pnpm-lock.yaml` file was created for project dependencies.
    claygorman committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    45b76a5 View commit details
    Browse the repository at this point in the history
  3. Update backend codebase, introduce Fastify handlers

    The update includes major restructuring in the backend codebase, primarily focused on introducing individual Fastify handlers for different server functionalities. Also, backend typings and model definitions have been moved to a different file. Dependencies and scripts in package.json have been updated, and new files fastify-ws.ts and hocuspocus.ts have been added. Finally, the Dockerfile.local and .tool-versions files have been adjusted accordingly.
    claygorman committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    7165c59 View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2024

  1. Refactor backend database models with enhanced Sequelize typings

    This code revision refactors the database models on the backend. The refactoring process involves enhancing and integrating Sequelize TypeScript typings, replacing 'DataTypes' with more specific Sequelize model types, and improving the correct typing of certain variables and return types. This will for sure facilitate scaling and ongoing development by boosting type safety, understanding, and editor-aided inspections of the models.
    claygorman committed Jan 4, 2024
    Configuration menu
    Copy the full SHA
    f560bd4 View commit details
    Browse the repository at this point in the history
  2. Add MinioGetObjectResponse type and update file handling

    We have introduced a new type, MinioGetObjectResponse, in the server index for better data structure comprehension. This change reflects an update in the way we handle files in the '/uploads/:file' route, removing the previously needed '@ts-ignore' and enhancing TypeScript integration. This should streamline file processing in the backend and improve overall code clarity.
    claygorman committed Jan 4, 2024
    Configuration menu
    Copy the full SHA
    e2dcbc3 View commit details
    Browse the repository at this point in the history
  3. Refactor CORS configuration in server index

    The CORS settings in the server index file have been refactored. The previous CORS settings relied on hard-coded conditions, this update introduces the usage of a separate handler function for setting up CORS OPTIONS. This will ensure modularity and improves the flexibility of the CORS configuration.
    claygorman committed Jan 4, 2024
    Configuration menu
    Copy the full SHA
    e17ab30 View commit details
    Browse the repository at this point in the history

Commits on Jan 6, 2024

  1. Refactor import and adjust request handling in server

    The User import was updated in apollo.ts to reflect its new location. In index.ts, the Fastify request import was expanded to enable a fleshed out request handler for 'multipart' content types. In fastify-ws.ts, the handling of 'multipart' requests was refined and moved to occur earlier in the preValidation hook. This helps ensure that multipart requests, notably for file uploads, are processed properly across the application.
    claygorman committed Jan 6, 2024
    Configuration menu
    Copy the full SHA
    4587e02 View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2024

  1. Add caching to handle user authentication

    A new caching mechanism has been introduced using NodeCache to handle user authentication and reduce database queries. The changes refactored the authentication process in the backend by moving the user authentication from Apollo and Fastify-WS to Fastify hooks. This change facilitates more efficient request handling in the server, improving performance. Furthermore, a new utility function, `hash`, is added to aid in creating cache keys.
    claygorman committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    3eceb03 View commit details
    Browse the repository at this point in the history
  2. Refactor hocuspocus-server.ts and add caching

    The code refactor primarily targets improving readability by breaking the server configuration into discrete functions. Additionally, a cache mechanism has been introduced for token verification process. This adjustment aims to boost performance by reducing redundant requests to JWT verification API whenever a valid token is presented.
    claygorman committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    3b7d5f7 View commit details
    Browse the repository at this point in the history
  3. Update fetch and store methods in hocuspocus-server

    Added type annotations to 'fetch' and 'store' methods in hocuspocus-server.ts. Additionally, simplified a condition check in 'store' method for 'issueComment' entityType.
    claygorman committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    d44da4b View commit details
    Browse the repository at this point in the history
  4. Refactor hocuspocus-server.ts for better typing and exception handling

    The code updates in hocuspocus-server.ts include the usage of types for better data handling and enhanced exception handling. It also includes changing the way JWT is verified with the addition of the VerifyJwtResponse type for more precise data extraction. Improvements finalize on refining the user fetching process from the database using the User type.
    claygorman committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    9de6b7e View commit details
    Browse the repository at this point in the history
  5. Refactor Backend DB Models and Adjust Resolvers

    Optimized Sequelize usage by using the `init` function instead of `define` in backend database models. This improvement led to more strict TypeScript typings, which increases code stability and makes development easier. Naming conventions were also adjusted for better semantic clarity. Manual updates on model associations and import paths were done accordingly. Resolvers were then adjusted to match the updated models.
    claygorman committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    c392605 View commit details
    Browse the repository at this point in the history
  6. Refactor Backend DB Models and Adjust Resolvers

    Optimized Sequelize usage by using the `init` function instead of `define` in backend database models. This improvement led to more strict TypeScript typings, which increases code stability and makes development easier. Naming conventions were also adjusted for better semantic clarity. Manual updates on model associations and import paths were done accordingly. Resolvers were then adjusted to match the updated models.
    claygorman committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    3bf56d8 View commit details
    Browse the repository at this point in the history
  7. updating

    claygorman committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    9b1233b View commit details
    Browse the repository at this point in the history
  8. Update ESLint config file reference for backend

    The ESLint configuration file for the backend has been renamed from .eslintrc to .eslintrc.json. Consequently, the reference to this file in .lintstagedrc has been updated to reflect this change.
    claygorman committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    773beb3 View commit details
    Browse the repository at this point in the history
  9. Update optional properties to CreationOptional

    Several properties across different models in `backend/src/db/models/types.ts` have been updated to use `CreationOptional`. This change provides better clarity that these properties can be undefined during instance creation. Additionally, the build script in `backend/package.json` has been simplified and the unnecessary `--resolve-extensions=.js` flag removed.
    claygorman committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    bcbd47f View commit details
    Browse the repository at this point in the history

Commits on Jan 8, 2024

  1. Add GraphQL code generation configuration and generated types

    This commit introduces a new `codegen.ts` file for configuring GraphQL code generation using `@graphql-codegen/cli`. Besides, it includes a large set of generated TypeScript types for existing GraphQL queries, mutations, and input types. This supports better type safety and autocompletion when working with GraphQL on the backend.
    claygorman committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    68449cd View commit details
    Browse the repository at this point in the history
  2. Update package versions in pnpm-lock.yaml

    The versions of '@graphql-codegen/cli', '@graphql-codegen/typescript', '@graphql-codegen/typescript-resolvers', and '@babel/traverse' have been fixed and updated in the pnpm-lock.yaml. The changes remove the range (caret) from the version specification, which ensures that the exact listed versions are used, improving the reliability of the build process.
    claygorman committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    298b332 View commit details
    Browse the repository at this point in the history
  3. Update import statements and enhance linting

    The code has been refactored to enhance TypeScript type safety by changing import statements to import type where applicable. Linting scripts have been updated with the integration of 'oxlint' and 'eslint'. This leads to improved code quality and adherence to coding standards. Additionally, the 'hocuspocus-server.ts' file has been refactored to improve the overall readability of the code.
    claygorman committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    226952a View commit details
    Browse the repository at this point in the history
  4. Add '@types/uuid' to backend dependencies

    The type definitions for 'uuid' have been added to the project's backend dependencies. This addition is visible in both package.json and pnpm-lock.yaml files, ensuring consistency and addressing possible type checking needs for 'uuid' in the backend.
    claygorman committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    11d690f View commit details
    Browse the repository at this point in the history
  5. Remove unused dependencies from pnpm-lock.yaml

    The 'module-alias', 'sharp', and '@types/module-alias' dependencies along with their related entries have been deleted from the pnpm-lock.yaml file. This commit also includes the removal of several additional subdependencies, improving the project's overall dependency management and reducing the install size.
    claygorman committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    261c308 View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2024

  1. Remove resolver types file

    The file 'backend/src/__generated__/resolvers-types.ts' was deleted. This file was auto-generated and used types definitions for GraphQL resolvers. Its removal suggests a clean up or a change in the approach for handling schema and type definitions.
    claygorman committed Jan 9, 2024
    Configuration menu
    Copy the full SHA
    86d0dfc View commit details
    Browse the repository at this point in the history

Commits on Jan 10, 2024

  1. Update backend dependencies and refactor resolvers

    Dependencies for the backend have been updated with the addition of "dataloader-sequelize". Also, the code for resolving graphql queries in the backend has been refactored to improve readability and maintainability. This includes the use of database calls for fetching data and using a custom "Date" scalar for date values in the graphql schema.
    claygorman committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    fe4cafa View commit details
    Browse the repository at this point in the history

Commits on Jan 11, 2024

  1. Refactor resolvers and types with Date to DateTime scalar

    This update changes 'Date' to 'DateTime' across GraphQL resolvers and generated types. The code now utilizes 'graphql-scalars' for the DateTime scalar implementation, resulting in improved clarity and consistency. The 'Date' scalar used previously was manually crafted hence changed for better clarity and functionality. Several query and mutation resolvers are updated to accommodate this change.
    claygorman committed Jan 11, 2024
    Configuration menu
    Copy the full SHA
    f6f3200 View commit details
    Browse the repository at this point in the history
  2. Convert IDs to numbers across multiple resolvers

    The identifiers used in project/index, issue-comment/index, board/index and user/index resolvers have been converted to numbers. This change aids in uniformity and prevents potential type-related bugs. Resolvers are also updated to use DataLoader for caching, reducing the number of database queries executing a significant performance enhancement.
    claygorman committed Jan 11, 2024
    Configuration menu
    Copy the full SHA
    b9446c4 View commit details
    Browse the repository at this point in the history
  3. Import and use AssetModel in user resolver

    AssetModel is now being imported into the user resolver in the backend. This has been used to properly type the variable findOldAvatarAsset. This will ensure more accurate and safer type-checking within the resolvers.
    claygorman committed Jan 11, 2024
    Configuration menu
    Copy the full SHA
    a34fd23 View commit details
    Browse the repository at this point in the history
  4. Refactor data mapping and date handling in resolvers and frontend com…

    …ponents
    
    This commit focuses on two main changes to the codebase. First, it streamlines the way data is mapped from database queries in resolver functions - unnecessary array spreads are removed, simplifying the array returns. Secondly, it modifies how dates are handled in a number of frontend components to use 'DateTime.fromISO' instead of 'DateTime.fromMillis', reflecting the way dates are stored and returned from the backend.
    claygorman committed Jan 11, 2024
    Configuration menu
    Copy the full SHA
    34e0132 View commit details
    Browse the repository at this point in the history
  5. Refactor resolver logic in multiple files

    Removed 'include' query parameter from the project resolver to simplify the database query. Updated the issue resolver to handle issueId as a Number type to ensure correct issue-board relationship. Modified the board resolver to fetch issues from viewState and handle data accordingly. These changes help improve code maintainability and consistency.
    claygorman committed Jan 11, 2024
    Configuration menu
    Copy the full SHA
    be1e254 View commit details
    Browse the repository at this point in the history
  6. Extend MyWebSocket interface and refactor usage

    The MyWebSocket interface has been extended by adding 'id', 'user', and 'namespace' optional properties. Following this extension, the way connection sockets are handled in the 'wsServer.handleConnection' method was also refactored. Instead of directly injecting the properties into the socket, a separate handleConnectionSocket object was created, which then gets passed to the method.
    claygorman committed Jan 11, 2024
    Configuration menu
    Copy the full SHA
    dd0fa32 View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2024

  1. Refactor websocket handler in Fastify server

    The handshake connection and message handling is now encapsulated within a separate `wsPlugin` function. This streamlines the main `fastifyWsHandler` function by allowing it to focus on fastify-specific configuration and registration tasks, improving code readability and maintainability.
    claygorman committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    ee766c3 View commit details
    Browse the repository at this point in the history