meetdude's People
meetdude's Issues
通知系統開發需求
Notification / Notifications
-
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 -
Notification kind (type)
0: receive post
1: receive friend invitation -
Model relationship
Notification belong to User
User has many Notifications
Notification.target -> user
user.notifications -> notification array -
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:
- user_id: specific user id
- search_type:
- 'TO': search posts which write to specific user
- 'FROM': search posts which write from specific user
- start_search_time: timestamp(UTC -> integer) as start point of the search
- is_forward:
- true: search posts newer than start_search_time
- false: search posts older than start_search_time
- 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:
- target_id shouldn't be null when create post
- user.target_posts should get all posts which target_id is equal to user.id
- user.posts should get all posts which user_id is equal to user.id
- post.user should get user which id is equal to post.user_id
- post.target should get user which id is equal to post.target_id
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.