Skip to content

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TaskManager

How to run?

To run this project, you need to:

  1. Install project on your machine
  2. Change server name in application.json to that one your machine has
  3. Run the app, all migrations will be applied automatically :)

Endpoints

API runs on https://localhost:7145 (changable) and has 2 controllers: UserController and TaskController. Lets walk over their endpoints:

UserController

  • /users/login - POST, allows users to log in using LoginRequestDto, which consists of Username and Password fields. If login was successful, user gets back responce with token inside, which they can use to authorize and access TaskController endpoints.
  • /users/register - POST, allows user to register using RegistrationRequestDto, which consists of Email, Password and Username fields. If success, user is created and saved in db, with hashed password.

TaskController

  • /tasks - GET, returns authorized user list of their tasks. Can be sorted by Priority, DueDate, Status, and ordered by Priority and/or DueDate.
  • /tasks/{id} - GET, returns user task based on id of that task if this task is assigned to that user. Else, returns exception.
  • /task - POST, creates task based on TaskOfUserDto, which contains Id, Name, Description, Status, Priority, DueDate and UserId as fields. Id and UserId are not requiered inputs, as they are changed authomatically, in case of UserId based on user that sends data.
  • /task - PUT, updates task based on same TaskOfUserDto. Does NOT update such fields as Id, UserId and CreatedTime.
  • /task/{id} - DELETE, removes task with specified id from db, if it is assign to the user making request.

Authentication

For authentication I made simple JwtTokenGenerator, that has claims for user Id, email, username. I also created PasswordHasher, that uses Pbkdf2 and HMACSHA256 algorithms. Finally, I created AuthService, that allows user to login and register, using PasswordHasher and JwtTokenGenerator to do it. It also tells user if their password is too easy (like special characters, number, upper/lowercase letters, etc.)

For now, thats it, be happy to use it or copy my code if you want it for some reason XD

About

Simple task manager API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages