Coder Social home page Coder Social logo

limbook-api's Issues

Error while running migration

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "image" does not exist

[SQL:
CREATE TABLE post_image (
post_id INTEGER NOT NULL,
image_id INTEGER NOT NULL,
PRIMARY KEY (post_id, image_id),
FOREIGN KEY(image_id) REFERENCES image (id),
FOREIGN KEY(post_id) REFERENCES post (id) ON DELETE cascade
)

Need activity tracker

For each user there should be an activity log:
e.g:
Table schema:
id, user_id, activity, created_at
Activity can be json like:
{ activity: "commented", "post_id": 1, "post_title": "my post"}

  • post_title is useful in case of delete where post is unavailable.
    enum: commented, reacted, created, updated, deleted

Improve file upload security

As of now, we are checking the file extension to allow only certain file type to be uploaded. We can do much better.

Production environ uses postgres where as test environ uses sqlite

An issue occured where all tests passed using sqlite but failed on production.
Friend.is_friend == 1 in one query passed for sqlite but failed for postgres due to boolean field constraint.

To prevent such issues. Production and Test environ should be as similar as possible

Add chat

  • User should be able to send private message to other user
  • There should be two copies of message for sender and receiver
  • User should be able to delete their copy of message
  • User should also be able to delete message they sent from receiver copy
  • May integrate AI reply

Add version to api end point

The api end point should be:
/v1/api-endpoint
instead of just: /api-endpoint

It's better if later have to support multiple versions.

Add pagination and filter to get resource

  • Right now resource is returning all items. We need to return around 10 items (the no. of items to return need to be configured from the config).
  • use the query parameter to achieve this

Add File or Image manager

Right now there is no image manger to handle file upload. We need to create one that has easy api to create file of different sizes and retrieve them. e.g:

Save

image = Image->add(image)
image->save(app.config.get('image_sizes'))

Retrieve

image = Image->query->get_using_id(image_id)

Auto generated posts, comments and reacts should have authentic id

Functions to generate post, comment and react for testing or automation purpose is generating post_id and user_id using rand_int which cannot be linked to Post or User object. If it can be linked to Post or User object, then it can be really helpful in seeding purpose.

Use OOP approach

Right now other than model, everything is function based.
Transform the code to OOP

Add scheduler

We need scheduler to do background tasks like:

  • clean up posts, notifications, or chat messages
  • send emails and may be run bot users (if that's included in future)

Suggestion:

  • Should be two scheduler, one to run urgent tasks other to run general background tasks.

Permission test is not explicit

If you look at the permission testing for any route, you can see that its testing permission from the token. We need to mock permission so that we can see against which permission we are testing.

Add notifications

  • Can implement third party service like Pusher
  • Better, if can implement own web-socket server to handle push notification
  • User should receive notification when someone interact with their post or send them message

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.