Skip to content

henriits/discordBot

Repository files navigation

Installation

  1. Clone the repository

  2. Navigate to the project directory

cd project
  1. Install dependencies
npm install

Setup

  1. Create .env file with the followings:
DATABASE_URL=./data/database.db
DISCORD_BOT_TOKEN=""
GIPHY_API=""
DISCORD_CHANNEL_ID=""

Migrations

Run Migrations:

npm run migrate:latest

Update types:

npm run gen:types

Usage

  1. Start the app
npm run dev

Creating new migration files

npm run create-migration -- fileNameProvidedByYou

Running tests

npm run test

Running test coverage

npm run coverage

API Documentation

Usage with Insomnia / Postman ( Api testing platform )

Students

Create Student

Request:

  • Method: POST
  • URL: http://localhost:3002/students
  • Body:
{
    "name": "silly",
    "username": "john_doe"
}

Get All Students

Request:

  • Method: GET
  • URL: http://localhost:3002/students

Get Student by ID

Request:

  • Method: GET
  • URL: http://localhost:3002/students/:id
  • Example http://localhost:3002/students/1

Update student

Request:

  • Method: PATCH
  • URL: http://localhost:3002/students/:id
  • Example http://localhost:3002/students/1
  • Body:
{
    "name": "new name",
    "username": "new_username"
}

Delete student

Request:

  • Method: DELETE
  • URL: http://localhost:3002/students/:id
  • Example http://localhost:3002/students/1

Sprints

Create sprints

Request:

  • Method: POST
  • URL: http://localhost:3002/sprints
  • Body:
{
    "sprintName": "WD-1.1",
    "sprintDescription": "Starting with python"
}

Get All sprints

Request:

  • Method: GET
  • URL: http://localhost:3002/sprints

Get sprint by ID

Request:

  • Method: GET
  • URL: http://localhost:3002/sprints/:id
  • Example http://localhost:3002/sprints/1

Update sprint

Request:

  • Method: PATCH
  • URL: http://localhost:3002/sprints/:id
  • Example http://localhost:3002/sprints/1
  • Body:
{
    "sprintName": "new name here",
    "sprintDescription": "new description here"
}

Delete sprint

Request:

  • Method: DELETE
  • URL: http://localhost:3002/sprint/:id
  • Example http://localhost:3002/sprint/1

Templates

Create template

Request:

  • Method: POST
  • URL: http://localhost:3002/templates
  • Body:
{
    "text": "template text goes here"
}

Get All Templates

Request:

  • Method: GET
  • URL: http://localhost:3002/templates

Get template by ID

Request:

  • Method: GET
  • URL: http://localhost:3002/templates/:id
  • Example http://localhost:3002/students/1

Update template

Request:

  • Method: PATCH
  • URL: http://localhost:3002/templates/:id
  • Example http://localhost:3002/templates/1
  • Body:
{
    "text": "new template text goes here"
}

Delete template

Request:

  • Method: DELETE
  • URL: http://localhost:3002/templates/:id
  • Example http://localhost:3002/templates/1

Messages

Create Message

Request:

  • Method: POST
  • URL: http://localhost:3002/messages
  • Body:
{
    "studentId": 1,
    "sprintId": 1
}

Get All Messages

Request:

  • Method: GET
  • URL: http://localhost:3002/templates

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published