-
Notifications
You must be signed in to change notification settings - Fork 0
Code style guide and string values
Darío edited this page Jul 1, 2019
·
1 revision
In this page of the wiki we will explain the coding conventions followed and some other details to keep the code consistent.
We use camel case for naming.
-
def createUser()is correct.-
def create_user()is not correct.
-
-
userName = "name"is correct-
user_name = "name"is not correct.
-
We use Upload, Create, Get, Update and Remove.
The difference between Upload and Create is not straightforward, hence:
- Upload is used to send data to the server (videos, images, etc).
- Create is used to create an entry in the database.
For example, to manage a user:
-
def uploadVideo(data)is correct-
def uploadUser(data)is most likely not correct (see above why).
-
-
def createUser(data)is correct.-
def addUser(data)is not correct
-
-
def getUser(data)is correct. -
def updateUser(data)is correct. -
def removeUser(data)is correct.-
def deleteUser(data)is not correct.
-
The user roles are strings and defined as:
- "user": base user without privileges.
- "admin": user with privileges over one or more datasets.
- "root": root user with full privileges.
Each role has different privileges:
- User can only manipulate data assigned to them.
- Admin can manage users and tasks for the datasets it is assigned to.
- Root can do all of the aforementioned and also manage datasets and admin users.
There are two dataset types currently implemented or on its way to be: PoseTrack and ActionInKitchen. They are sometimes directly mentioned in the code, and then they will always be:
- "poseTrack" for PoseTrack, sometimes defined in the object and referenced as "this.pt" or "self.pt"
- "actionInKitchen" for ActionInKitchen, sometimes defined in the object and referenced as "this.aik" or "self.aik"