Skip to content

Josiah5x/Todo-List-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Todo-List-API

Todo-List-API-With-Golang MVC

Welcome to our project! This is a Todo list App made in Golang using MVC pattern and Databas(mongoDB). It allows users to quickly and easily Add,Update Delete. With this App, users can effortlessly manage their tasks and events, helping them stay organized and on top of their to-do list. We hope you enjoy and we look forward to your contributions!


User Section

Register :

  • Require Firstname, Lastname Email Username, password
  • Return appropriate response

Login :

  • Require email and password as the post body.
  • Authenticate the user through provided credentials.
  • If the user is verified eg(username and password) is correct, respond with a JWT token, otherwise show the appropriate response

Creating new User

POST /v1/user (Creating new user)
#Request
{
    "userid":"",
    "firstname":"nungrie",
    "lastname":"galadima",
    "email":"nungrie0519@gmail.com",
    "username": "nung",
    "password": "3534"
}
Parameters
name type data type description
None required object (JSON) N/A
Responses
User Successfully Added
Example cURL
 curl -X POST -H "Content-Type: application/json" --data @post.json http://localhost:8080/v1/user/
POST /v1/user/login (User login)
#Request
{
    "username": "nung",
    "password": "3534"
}
Parameters
name type data type description
None required object (JSON) N/A
Responses
User Successfully Login
Example cURL
 curl -X POST -H "Content-Type: application/json" --data @post.json http://localhost:8080/v1/user/

List of existing users

GET /v1/user/all (gets all User)
Parameters

None

Responses
 {
    "_id": "5ab6ca49-fa35-4049-8b0d-f6f35db4bc85",
    "firstname": "nungrie",
    "lastname": "galadima",
    "email": "nungrie0519@gmail.com",
    "username": "nung",
    "password": "3534",
    "create_at": "2023-04-19T15:49:50.982+01:00",
    "update_at": "0001-01-01T00:00:00Z"
    .....
  }                                     
Example cURL
 curl -X GET -H "Content-Type: application/json" http://localhost:8080/v1/user/all
GET /v1/user/some-unique-uuid-string (gets a specific User by some-unique-uuid-string)
Parameters
name type data type description
stub_numeric_id required int ($int64) The specific stub numeric some-unique-uuid-string
Responses
http code content-type response
200 text/plain;charset=UTF-8 string
400 application/json {"code":"400","message":"Bad Request"}
Example cURL
 curl -X GET -H "Content-Type: application/json" http://localhost:8080/v1/user/some-specific-unique-uuid-string

Update existing User

PUT /v1/user/some-specific-unique-uuid-string (updates user by some-unique-uuid-string)
#Request
{
    "_id": "5ab6ca49-fa35-4049-8b0d-f6f35db4bc85",
    "firstname": "nungrie",
    "lastname": "galadima",
    "email": "nungrie0519@gmail.com",
    "username": "nung",
    "password": "3534",
}
name type data type description
uuid required string The specific unique idendifier
Responses

Successfully Updated

Example cURL
 curl -X PUT -H "Content-Type: application/json" --data @put.json http://localhost:8080/v1/user/some-unique-uuid-string

Update user by Patching

#Change Password
PATCH /v1/user/changepassword/some-unique-uuid-string (updating a password by specific user by patching )
#Request
{
  "password": "1234"
}
Responses
Password Successfully Updated 
Example cURL
 curl -X PATCH -H "Content-Type: application/json" http://localhost:8080/v1/user/changepassword/some-unique-uuid-string

Deleting existing User

DELETE /v1/user/delete/some-unique-uuid-string (Delete user by some-unique-uuid-string)
Parameters
name type data type description
uuid required string The specific stub unique idendifier
Responses
Successfully Deleted
Example cURL
 curl -X DELETE -H "Content-Type: application/json" http://localhost:8080/v1/user/delete/some-unique-uuid-string

Todos Section

  • User Section must be satisfy before accessing the todo endpoint.

Create ToDo :

  • Only accessible for authenticated users 2 fields are required: name, description and deadline of the ToDo item
  • On success save the item to the database
  • Return appropriate response
POST /v1/todo (Creating new todo)
Body(--data @post)
 {
  "name": "DevOP",
  "description": "Basic of DevOp",
  "deadline": "12h"
}
Parameters
name type data type description
None required object (JSON) N/A
Responses
Todo created successfully 
Example cURL
 curl -X POST -H "Content-Type: application/json" --data @post.json http://localhost:8080/v1/todos/

View ToDo :

  • Only accessible for authenticated users
  • Respond with an object containing the title and description of the requested ToDo
GET / (gets all todos)
Parameters

None

Responses
http code content-type response
200 text/plain;charset=UTF-8 string
Example cURL
 curl -X GET -H "Content-Type: application/json" http://localhost:8080/v1/todos/
GET /some-unique-uuid (gets todo by some-unique-uuid)
Parameters
name type data type description
uuid required string T some-unique-uuid string
Responses
http code content-type response
200 text/plain;charset=UTF-8 string
400 application/json {"code":"400","message":"Bad Request"}
Example cURL
 curl -X GET -H "Content-Type: application/json" http://localhost:8080/v1/todos/

Updating existing Todo

PUT /v1/todos/some-unique-uuid (updates todos by some-unique-uuid)
Request
{
 "name": "DevOP",
 "description": "Basic of DevOp",
 "deadline": "12h"
}
Parameters
name type data type description
uuid required string The specific proxy config unique idendifier
Responses

updated successfully

Example cURL
 curl -X PUT -H "Content-Type: application/json" --data @put.json http://localhost:8080/v1/todos/some-unique-uuid-string

Update Todos by Patching :

#Status Done/Undone / #Deadline
  • Only accessible for authenticated users
  • 1 fields are required: Status and Deadline of the ToDo item
  • On success save an updated item to the database
  • Return appropriate respon
PATCH /v1/todos/mark/some-unique-uuid (updating a specific todos by patching Done or Undone)
Request
{
"status": "Done"
}
Parameters
name type data type description
uuid required string The specific unique idendifier
Responses

Update successfully |

Example cURL
 curl -X PATCH -H "Content-Type: application/json" http://localhost:8080/v1/todos/some-unique-uuid
PATCH /v1/todos/deadline/some-unique-uuid (update the todos by patching deadline(eg 24h) )
Request
{
"deadline": "24h"
}
Parameters
name type data type description
uuid required string The specific unique-uuid string
Responses

Update successfully

Example cURL
 curl -X PATCH -H "Content-Type: application/json" http://localhost:8080/v1/todos/some-unique-uuid string

Delete ToDo :

  • Only accessible for authenticated users.
  • On success delete the item from the database.
  • Return appropriate response.
DELETE /v1/todos/some-unique-uuid (Delete todos by some-unique-uuid)
Parameters
name type data type description
uuid required string The specific unique-uuid string
Responses

Deleted successfully

Example cURL
 curl -X DELETE -H "Content-Type: application/json" http://localhost:8080/v1/todos/some-unique-uuid

About

Todo-List-API-With-Golang MVC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages