/Backend-Recruitment

A customer CRUD API with Authentication, Role and email provider for sending activation code written in Nestjs, GraphQL, Prisma, Postgres

Primary LanguageTypeScript

Backend-Recruitment

npm version npm version License: MIT

Table of Contents

Introduction

This is a RESTful API for customer recruitment

Project Structure

├── src
├── .env.sample
├── .eslintrc
├── .gitignore
├── .prettierrc
├── Makefile
├── nest-cli.json
├── package.json
├── README.md
└── tsconfig.build.json
└── tsconfig.json

Project Database Architecture

Customer Model

  • id
  • email
  • password
  • refreshToken
  • role [ADMIN, USER]
  • code
  • emailConfirm
  • createdAt
  • updatedAt
  • deletedAt

Features Implemented

  • Sign up with [accessToken and RefreshToken]
  • Sign in
  • Ability to verify customer's account after signup with activation code;
  • Resend activation code through email
  • Create tokens ( A refresh token when access token get expired)
  • Logout
  • Role [ADMIN, USER]
  • Get customer
  • Fetch customers with pagination
  • Change of password
  • Update customer
  • Soft delete customer
  • Search functionality for customer by Role, id and email

Getting Started

Dependencies

This project uses Nest.js It has the following dependencies:

Prerequisites

  • Ensure you have NodeJS installed by entering node -v on your terminal If you don't have NodeJS installed, go to the NodeJS Website, and follow the download instructions

Installation & Usage

  • After cloning the repository, create a .env file from .env.sample and set your local .env. variable(s).
cp .env.sample .env
  • Install the dependencies
npm run install
  • You can run the server using
npm run start:dev

Using the Makefile to Testing

How to run all tests locally

  1. make install - Installs dependencies.
  2. make dev - Run the server
  3. make build
  4. make migrate - Generate migration.
  5. make lint - Lint code.
  6. make studio - Opens up a prisma virtual interface for your database
  7. make seed - run seed

Working Routes

API Endpoints

  • Public API documentation of this project is available on postman docs

License 💥

This project is under the MIT LICENSE