Code Monkey home page Code Monkey logo

easyalert's People

Contributors

bakku avatar

Watchers

 avatar  avatar

easyalert's Issues

Implement delete endpoint for users

Users should be able to delete their account using their token in the Authorization header.
Request:

DELETE /api/users/me
Authorization: Bearer 12345

Response:

HTTP 204

Send alerts upon create

For development/testing we need some kind of mailcatcher.

When an alert is successfully sent the status and sent_at should be updated, on failure only the status should be updated.

This ticket also includes some kind of background job/worker logic so the API can enqueue mailing jobs.

Implement update endpoint for users

Users should be able to update their email and password using their token in the Authorization header. It should also be possible to only update the email or only update the password.

Request:

PUT /api/users/me
Authorization: Bearer 12345

{
    “email”: “[email protected]”,
    “password”: “12345”    
}

Response:

HTTP OK

{
    "token": "12345"
}

Implement auth refresh endpoint to renew token

In case a token or the password is comprimised, users should be able to refresh their token.

Request:

PUT /api/auth/refresh
Authorization: Token 12345

Response:

HTTP OK

{
    “token”: “67890”
}

Revisit notification system

There are a few things that should be changed. Easyalert should be terminal-first and we probably have to save subject instead of having a name...

Implement endpoint to get all alerts

Request:

GET /api/alerts
Authorization: Bearer 12345

Response:

[
    {
        “subject”: “Hello!”,
        “status”: “sent”,
        “sent_at”: “2018-01-01T01:00:00Z”,
        “created_at”: “2018-01-01T00:00:00Z”
    },
    …
]

Differentiate between Accept JSON and no Accept header

If no accept header is sent, easyalert will assume that the request came from a terminal.
It will then return text instead of JSON and will provide helpful curl commands for further usage
of the API.

Try to refactor the API as far as possible.

Furthermore add a ?silent parameter so the terminal version does not produce too much output

Add proper validation to the API when creating a new user

When creating a user that already exists the API just returns:

{
  "error": "User could not be created. Verify that you sent valid data."
}

A more specific error however should be returned. E.g.:

{
  "error": "Email is already taken."
}

It is also possible to send a user without an email or a password. Both should be validated as well.

Add migration for alerts table

Alerts are the entity that contain all the information of the alert which should be sent.

Table structure:

id BIGSERIAL PRIMARY KEY
subject TEXT NOT NULL
status smallint NOT NULL
sent_at TIMESTAMP DEFAULT NULL
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE
created_at TIMESTAMP NOT NULL
updated_at TIMESTAMP NOT NULL

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.