Git Product home page Git Product logo

meetdude's People

Contributors

dwliao avatar tinganliu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

meetdude's Issues

通知系統開發需求

Notification / Notifications

  1. Column
    type(int): Notification kind
    user_id(int): source user
    target_id(int): target user
    is_read(bool): has been read or not, default is false

  2. Notification kind (type)
    0: receive post
    1: receive friend invitation

  3. Model relationship
    Notification belong to User
    User has many Notifications
    Notification.target -> user
    user.notifications -> notification array

  4. Model class method (scope)
    unread_notifications

Need Post.which_related_to(user_id, search_type, start_search_time, is_forward, limit_number)

Need class method of Post model which can handle given inputs and return some posts which related to specific user id

Input parameter:
  1. user_id: specific user id
  2. search_type:
    • 'TO': search posts which write to specific user
    • 'FROM': search posts which write from specific user
  3. start_search_time: timestamp(UTC -> integer) as start point of the search
  4. is_forward:
    • true: search posts newer than start_search_time
    • false: search posts older than start_search_time
  5. limit_number: (option) limit search number, nil means all
Return:
  • posts: array of posts which descending order by updated_at
Notes:

To reach this goal as Rails way, maybe we can chain some customized scopes

Add some model tests related to post, user and target

We need some model tests which cover:

  1. target_id shouldn't be null when create post
  2. user.target_posts should get all posts which target_id is equal to user.id
  3. user.posts should get all posts which user_id is equal to user.id
  4. post.user should get user which id is equal to post.user_id
  5. post.target should get user which id is equal to post.target_id

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.