Introduction to models¶
All models are defined in
models.pyin theapp/directory. They use Flask-SQLAlchemy to map Python classes to database tables.The database is DBMS-agnostics, so SQLite is used for development and testing, while PostgreSQL is used in production.
Models¶
User¶
The user model stores registered user, handles authentication, session management, admin status, blocking and API token generation.
Field |
Type |
Description |
|---|---|---|
|
Integer |
Primary key. |
|
String(50) |
Unique. Used for login. |
|
String(100) |
Unique. Normalized to lowercase. |
|
String(128) |
Bcrypt hash. Raw passwords are never stored. |
|
DateTime |
Updated on activity. UTC. |
|
Boolean |
Grants access to the admin blueprint. |
|
Boolean |
Blocked users are logged out on every request. |
|
Integer |
Reset on successful login or when unblocked. |
|
DateTime |
Set on registration. UTC. |
|
String(32) |
API token. Generated on registration. |
|
DateTime |
Token expires after 1 hour. Auto-renews if less than 60 seconds remain. |
Rooms¶
The room model represents a call session. Each room created by the user has a unique code and belongs to an owner.
Field |
Type |
Description |
|---|---|---|
|
Integer |
Primary key. |
|
String(9) |
Unique. Generated automatically when user creates a room. |
|
DateTime |
Set on creation. UTC |
|
Integer |
Foreign key. Displays the id of the user who created the room. Cascades on delete. |
RoomParticipant¶
This model breaks down a table which has many-to-many relationship between users and rooms.
Field |
Type |
Description |
|---|---|---|
|
Integer |
Primary key. |
|
Integer |
Foreign key to |
|
Integer |
Foreign key to |
Transcript¶
This model stores the sign language recognition output that is generated by the model during the call. A single room can have multiple transcripts.
Field |
Type |
Description |
|---|---|---|
|
Integer |
Primary key. |
|
Text |
The recognized sign language output. Nullable |
|
DateTime |
Set on creation. UTC |
|
Integer |
Foreign key to |
Messages¶
This model saves the messages sent by the users while in call.
Field |
Type |
Description |
|---|---|---|
|
Integer |
Primary key. |
|
Text |
Message content. Nullables |
|
DateTime |
Set on creation. UTC |
|
Integer |
Foreign key to |
|
Integer |
Foreign key to |