Giter VIP home page Giter VIP logo

density_labs_test's Introduction

Density labs test

This app is a simple grading system.

Grades Management System

This project is a comprehensive implementation of a grades management system with user authentication, role-based access control, API endpoints, and email notifications. The system allows admins to manage students, courses, and grades while students can view their own grades and courses.

Features

  • User Authentication with Devise and JWT
  • Role-based Access Control with CanCanCan
  • RESTful API Endpoints
  • Email Notifications for Grade Updates
  • Validations to Ensure Data Integrity

Getting Started

Prerequisites

  • Ruby 3.3.2 or later
  • Rails 7.2 or later
  • PostgreSQL (or any other database supported by ActiveRecord)
  • Docker Compose version v2.10.2

Installation

  1. Clone the repository:
git clone https://github.com/AlfredoElizarraras/density_labs_test.git
cd density_labs_test
  1. Install dependencies:

Please ensure you are using Docker Compose V2. This project relies on the docker compose command, not the previous docker-compose standalone program.

https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command

Check your docker compose version with:

% docker compose version
Docker Compose version v2.10.2

Initial setup

cp .env.example .env
docker compose build
docker compose run --rm web bin/rails db:setup
docker compose run --rm web bin/rails db:migrate
docker compose run --rm web bin/rails db:seed

Running the Rails app

docker compose up

Use admin user in seed as a starting point

Running the Rails console

When the app is already running with docker-compose up, attach to the container:

docker compose exec web bin/rails c

When no container running yet, start up a new one:

docker compose run --rm web bin/rails c
  1. Run the server:
docker compose run --rm web bin/rails server

API Endpoints

Authentication

  • Sign In:

    POST /api/v1/login

    Body:

    {
      "user": {
        "email": "[email protected]",
        "password": "password"
      }
    }
  • Sign Out:

    DELETE /api/v1/logout

    Header:

    Authorization: Bearer <jwt_token>

Students

  • Create Student:

    POST /api/v1/admin/students

    Body:

    {
      "student": {
        "email": "[email protected]",
        "password": "password",
        "password_confirmation": "password",
        "name": "New User",
        "age": 25
      }
    }
  • Update Student:

    PUT /api/v1/admin/students/:id

    Body:

    {
      "student": {
        "email": "[email protected]",
        "name": "Updated User",
        "age": 26
      }
    }
  • Delete Student:

    DELETE /api/v1/admin/students/:id
  • List Students:

    GET /api/v1/admin/students

Courses

  • Create Course:

    POST /api/v1/admin/courses

    Body:

    {
      "course": {
        "name": "Math"
      }
    }
  • Update Course:

    PUT /api/v1/admin/courses/:id

    Body:

    {
      "course": {
        "name": "Advanced Math"
      }
    }
  • Delete Course:

    DELETE /api/v1/admin/courses/:id
  • List Courses:

    GET /api/v1/admin/courses

Grades

  • Create Grade:

    POST /api/v1/admin/grades

    Body:

    {
      "grade": {
        "student_id": 1,
        "course_id": 1,
        "quarter": 1,
        "grade": 8
      }
    }
  • Update Grade:

    PUT /api/v1/admin/grades/:id

    Body:

    {
      "grade": {
        "grade": 9
      }
    }
  • Delete Grade:

    DELETE /api/v1/admin/grades/:id
  • List Grades:

    GET /api/v1/admin/grades

Usage

Sign In

To sign in, use the /api/v1/sign_up endpoint with the email and password of an existing user. This will return a JWT token, which you should include in the Authorization header for all subsequent requests.

Sign Out

To sign in, use the /api/v1/sign_out endpoint with the token received in signed in. This will return a succesfull message.

Managing Students

Admins can create, update, delete, and list students using the respective API endpoints.

Managing Courses

Admins can create, update, delete, and list courses using the respective API endpoints.

Managing Grades

Admins can create, update, delete, and list grades using the respective API endpoints. Students will receive email notifications when their grades are created or updated.

Credits

This project was developed based on the following resources and inspirations:


density_labs_test's People

Contributors

alfredoelizarraras avatar

Watchers

Lucian avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.