Coder Social home page Coder Social logo

dude-expenses-backend's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

isgasho

dude-expenses-backend's Issues

Create expenses table

Add a migration for creating a table to hold expenses.

ID primary key auto incrementing
Price (in cents)
Date
Tag
Notes

Get list of expenses

Returns all expenses. Accepts a month parameter to filter expenses by date. If no month is given should return the current month.

Create a new expense

Accepts price, date, tag and notes.

Price must be decimal greater than zero. Date and tag cannot be blank.

If tag does not exist, create one. Notes are optional.

Responds with the validation errors if expense cannot be created.

DB table to store users

  • Create a users table (id (pk), email, password, created_at, updated_at)
  • Create an index for email
  • Add user_id foreign key in expenses table

User login

Accepts an email and a password. If the email and password combination matches that of an existing user, it should return a success response status.

Handler middleware

Every framework has them ๐Ÿ˜„

We need to be able to do something like:

routes.Handle("/expenses", JsonResponse(CommonHeaders(Logging(Authentication(WithDBAccess(expenses.Index)))))

The API is a bit ugly, but the idea is that each middleware stack should access the response writer and the request and set up things for the next stack, until we reach our final handler in the chain, which could of course set things for an upper level middleware.

For example the logging middleware could gather some info before and after the request is handled, and log in the end (defer).

Automatically run migrations

Create a script that goes through the db/ folder and executes all migrations in series.

Maybe it's worth it to check out existing packages for this.

Add endpoint for user authentication

POST /authentications. Should accept email and password params.

Check email and password combination and return an authentication token for the user.

Do we want to support authentication expiration?

User registration

This issue is about creating a user account. The app should accept an email and a password.

Email should be unique. Password should be at least 6 characters.

On success, it should create a new user with the above information. On error, it should return the validation errors.

Encrypt user passwords in the database.

Add logging support

  • Investigate logging solutions/practices for Go programs.
  • Add a logger, configure it for production and development.
  • Go through the app and check all places that need logging.

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.