---
# System prepended metadata

title: Push in 48 hours

---

# Push in 48 hours

![](https://i.imgur.com/vuBYFwu.jpg)

Mobile REST:
1. Handle http POST /login with LastTime, ID
2. If User exists - update LastTime, else - creae user with ID + last time
3. Save it in DB
P.S we need a handler that will be protected

DB: 
1. Use Postgres DB 
2. Only 1 table: UserID, LastTimeAt, LastNotifiedAt


Sheduler:
1. Each 30 minutes go to DB 
2. Find LastTime и LastNotifiedAt for each user
3. If now - last time > 48 hours && LastNotifiedAt > 48 hours Do (4.)
4. Send to MQ user's ID, change LastNotifiedAt to the NOW

MQ: 
1. Use Rabbit MQ

Worker :
1. Get any User from MQ
2. Make a PUSH 
3. If succeded - delete from MQ these user

