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

email

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

class janua.db.database.ContactGroup(**kwargs)[source]

Contact group relation database model

Unique constraint:
  • unique tuple of group and contact id
id

primary key id

group_id

group id foreign key

contact_id

contact id foreign key

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

authorized

whitelisted or blacklisted

status
SMS status. Corresponding values:
  1. SENT
  2. SENT/DELIVERED
  3. SENT/UNKNOWN
  4. UNSUPPORTED
  5. 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

email

administrator email, should be unique

level
administrator level:
  1. super administrator
  2. 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

authorized_group

groups object which are authorized to trigger action

authorized_supervisor

administrator object which are authorized to trigger action

contact_notify

contact notify object

Authorized group action table

class janua.db.database.AuthorizedGroupAction(**kwargs)[source]

Authorized group action database model

Unique constraint:
  • unique tuple of group and action id
id

primary key id

group_id

group id foreign key

action_id

action id foreign key

Authorized supervisor action table

class janua.db.database.AuthorizedSupervisorAction(**kwargs)[source]

Authorized administrator action database model

Unique constraint:
  • unique tuple of admin and action id
id

primary key id

admin_id

admin id foreign key

action_id

action id foreign key

Contact notify action table

class janua.db.database.ContactNotifyAction(**kwargs)[source]

Contact notify action database model

Unique constraint:
  • unique tuple of contact, action and group id
id

primary key id

contact_id

contact id foreign key

action_id

action id foreign key

group_id

group id foreign key

Commands table

class janua.db.database.Commands(**kwargs)[source]

Command database model

id

primary key id

command

command string identifier

params

command parameters in JSON format

Config table

class janua.db.database.Config(**kwargs)[source]

Config database model

key

configuration key parameter

value

configuration key value