Created
March 27, 2014 23:44
-
-
Save mikeadeleke/9821724 to your computer and use it in GitHub Desktop.
Twilio Phone Number model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Twilio_Phone_Number_Table | |
# id number active(boolean) | |
# 1 423-123-1233 0 | |
# 2 423-123-1233 1 | |
# Listing Table (has many appointments) | |
# lister_id status | |
# Appointment Table | |
# requester_id twilio_phone_id status | |
# User | |
# has phone_# | |
# when a user creates an apointment on a listing | |
# find an active twilio phone number and attach that to the appointment | |
# if another apointment is created then attach a new twilio to that apointment. | |
# each appointment has a unique phone number | |
# when requester or lister sends sms to lister requester | |
# User.find_by_phone_number(sender_phone_#) | |
# TwilioPhone.find(the twilio # it got sent to) | |
# You want to do some type of Join query that checks ther is an open Appointment with that phone number | |
# and requester or lister id | |
# if so | |
# send the message to the appropriate party | |
# when lister replies | |
# do the same thing as above - same logic applies | |
# When an appointment closes then the status changes and the # becomes active again | |
# when a listing closes then make sure all apointments are closed and all related phone numbers become active again | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment