Links to 1.1 and 1.2 (App idea & Prototype) blogs:-
1.https://medium.com/@aamircnd2/hasura-internship-2017-task-1-1-three-screen-app-idea-3107e7047348
2.https://medium.com/@aamircnd2/hasura-internship-2017-task-1-2-app-wire-frame-prototype-bb28d7e8760a

The data model for Image Manager consists for 4 tables and it leverages the Hasura Users table to store user credentials like username, password and email.

Here is a diagram describing the tables used in the model

Data Model

This schema was made using PonyOrm

Details about the Tables in model:-

1.Hasura Auth Table:
The hasura users table not only stores the users credentials provided on sign-up but also assigns roles to the now registered user, the roles being an Admin role or User role.This table has the Read and Write permissions only to the creator.

2.Profile Table:
This table leverages the Hasura Auth table and has the Write permissions to the user and Read permission to all, i.e to user and anonymous roles.

  • user_id: auto incrementing interger column, serves as the primary key for this table and references(is a foreign key ) to user_id column in the Hasura
  • username: text column, not null-able and also references the username column in Hasura Auth Table

3.Image Table:
Stores information about the images added to there Gallery by the user

  • image_id: auto incrementing interger column, serves as the primary key for this table.
  • user_id: foreign key to user_id in the profile table.
  • url: Text column to store the url of the image
  • caption and description columns: to store additional info about the image

4.Tag Table:
Contains tags that can be added to each image in the Image table of the user, and each image can have multiple tags (this one-to-many mapping is made possible using the Image_Tag table)

  • tag_name: a text columns serves as the primary key

5.Image_Tag Table:
Is a intermediate table that makes the one to many mapping from image table to tag table possible by containing 2 foreign keys to one to each table

  • image_id: foreign key to image_id in image table.
  • tag_name: foreign key to tag_name in tag table.
  • image_id and tag_name both serve as the primary key for this table

All the tables in the model have Write permission assigned to only the User and the Admin Role. All tables except the Hasura Auth table have read permission set to All, i.e user + admin + anonymous Roles.

--

--