Database model¶
Contact table¶
- class
janua.db.database.Contact(**kwargs)[source]¶Contact database model
- Unique constraints:
- unique tuple of phone number and admin id
- unique tuple of email and admin id
id¶primary key id
name¶contact name
firstname¶contact firstname
phone_number¶contact phone number
contact email
description¶contact description
admin_id¶id of admin which manage this contact
groups¶group list in which this contact belong to
Group table¶
- class
janua.db.database.Group(**kwargs)[source]¶Group database model
- Unique constraint:
- unique tuple of name and admin id
id¶primary key id
name¶group name
description¶group description
admin_id¶admin which manage this group
contacts¶contact which belong to this group
actions¶actions this group have permission to trigger
Contact group table¶
Sms table¶
- class
janua.db.database.Sms(**kwargs)[source]¶SMS log database model
id¶primary key id
date_time¶store received or send sms date time
sender¶fullname sender
recipient¶fullname recipient
recipient_phone_number¶recipient phone number
raw_message¶message body
whitelisted or blacklisted
status¶
- SMS status. Corresponding values:
- SENT
- SENT/DELIVERED
- SENT/UNKNOWN
- UNSUPPORTED
- RECEIVED
reference¶reference id for concatenated SMS
number_of_slices¶number of SMS chunks
admin_id¶admin which send the SMS
Admin table¶
- class
janua.db.database.Admin(**kwargs)[source]¶Admin database model
id¶primary key id
name¶administrator name
firstname¶administrator firstname
phone_number¶administrator phone number, should be unique
has_client¶is administrator have Janua client ?
password¶administrator encrypted password
administrator email, should be unique
level¶
- administrator level:
- super administrator
- supervisor
sms_quota¶
- administrator SMS quota of the form “number X” where X could take:
- D: mean number per day
- W: mean number per week
- M: mean number per month
- Y: mean number per year
recipient_filter¶is administrator restricted to whitelist or can send to any recipients
last_quota_reached¶when administrator has been last notified about reached sms quota
login¶administrator login, should be unique
phone_token¶administrator phone token, used by Janua client, should be unique
web_auth_token¶administrator web token, for web interface and REST API, should be unique
auth_backend¶which authentication backend does it use
Action table¶
- class
janua.db.database.Action(**kwargs)[source]¶Action database model
id¶primarey id key
name¶action name, obtained by lower action class name string, should be unique
description¶action description, obtained by taking action class docstring
module¶action module path, should be unique
authentication¶is action require authentication
enabled¶is action enabled
admin_id¶admin who manage this action
janua_id¶unique id for internal use, don’t touch this
admin¶admin object
groups object which are authorized to trigger action
administrator object which are authorized to trigger action
contact_notify¶contact notify object