Giter VIP home page Giter VIP logo

blog's People

Contributors

alielbashir avatar bisguzar avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

blog's Issues

Set up frontend

Setup the Vue.js-based frontend with a project structure according to best practices

Handle different scopes for users

Different users should be able to do different things, which can be handled with scopes. Some users should be able to write new blog posts, while some others should only be able to read , according to their choice while registering.

Add posts routes

Posts router will include basic CRUD operations for blog posts

Endpoints

Create post

POST /api/posts

example request

{
    "title": "vscode tutorial",
    "content": "In this blog I'll be explaining how to use vscode, first step is to...",
}

example responses

HTTP status 201
HTTP status 401
HTTP status 403

Get posts

GET /api/posts

example response

{
    "posts": [
        {
            "title": "vscode tutorial",
            "id": 11,
            "creation_date": 1649212132,
            "username": "janedoe",
            "content": "In this blog I'll be explaining how to use vscode, first step is to...",
            "votes": 3
        },
        {
            "title": "codeblocks tutorial",
             "id": 131,
             "creation_date": 1649213057,
            "username": "johndoe",
            "content": "In this blog I'll be explaining how to use codeblocks, first step is to...",
            "votes": -26
        }
    ]
}

Delete post

DELETE /api/posts/{id}

example response

{"message": "post deleted successfully"}

Upvote/Downvote

POST /api/posts/{id}/upvote

POST /api/posts/{id}/downvote

example response

HTTP status 200
HTTP status 404

Add user routes

Add routes for user endpoints. User endpoints will be:

  • POST /api/users/register {username: str, password:str} -> {username: str}
  • POST /api/users/login {username: str, password:str} -> {token: str}

Failing concurrent test runs

as seen in this and this workflow runs, the pytest step can fail sometimes where a bad request is registered for user login, and consequently other tests that may depend on user login.

Possible reason

Because the workflows run in parallel for 3.8 and 3.10 now, they can be running on the same database instance, which can cause conditions where a user is attempting to be registered that is already registered in the system, which can give back a 400 error.

Possible fixes

  • Use different databases for different workflow runs
  • Run the workflows in a sequence so they're not doing DB operations concurrently.

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.