classes - THM-ATLAS/spring-backend GitHub Wiki
src/main/kotlin/com/example/atlasbackend/classes
Assets represent Pictures and files uploaded to ATLAS. It is connected to Database Table assets
.
It contains the variables:
-
asset_id
: Unique ID. Primary key annotated with @Id -
asset
: ByteArray, that actually contains the File or Picture -
public
: Boolean. Indicates if the given asset is public or not. Public assets can be seen by everyone (e.g. profile pictures) -
filename
: String. Name of the File saved inasset
AssetBase64 represents an asset coded as Base64
It contains the variables:
-
asset_id
: ID of the given asset -
asset
: String. Contains the file encoded as Base64 -
public
: Boolean. Indicates if the given asset is public -
filename
: String. Filename of the asset
AtlasIcon represents an Icon, that can be part of a module or tag name. Database table: icon
.
It contains the variables:
-
icon_id
: Prmary kex annotated with @Id -
reference
: String. Name of the icon
AtlasModule is the module as found in the databank as table module and marked @Table("module")
.
It contains the variables:
-
module_id :Int
Unique ID. It is the primary key and is marked with@Id
. -
name :String
the name of the module. -
description: String
a short description of the module. -
modulePublic: Boolean
Assigns whether the module is public, with annotation @field:Column("public") to the database. -
icon_id :Int
Id of a Icon
AtlasModuleRet is the module that we Return on requests. It contains everything from the Atlasmodule and the complete Icon instead of the icon_id
AtlasUser is the user as found in the database as table user and marked with @Table("user")
.
It contains the variables:
-
user_id :Int
Unique ID. It is the primary key and is marked with@Id
. -
name :String
the user's name. -
username :String
the login username. -
email :String
the users email. -
(private) password :String
value for user's password.
In addition to database variables:
-
roles :MutableCollection<Role> = mutableListOf
list of roles belonging to the user.
The AtlasUser is also part of the UserDetails interface. This is part of the Security
Submission containing code in a specific language. Database table: submission_code
It contains the following variables:
-
submission_id
: Primary key, foreign key to the submission containing this code, annotated with @Id -
content
: String. The code, that was submitted -
language
: Int. Foreign key to the programming language the content is written in
Exercise is the task as found in the database as the exercise table and labeled @Table("exercise")
.
It contains the variables:
-
exercise_id :Int
Unique ID. It is the primary key and is marked with@Id
. -
module_id :Int
ID of the module to which the exercise belongs. -
type_id :Int
ID of the type to which the task is assigned. -
title :String
Title of the task. -
content :String
Content of the task. -
description :String
short description of the task. -
exercisePublic :Boolean
Assigns whether the task is public, with annotation @field:Column("public") to the database.
ExerciseRet is the task we Return on requests. It contains content from multiple tables in the database.
It contains the variables:
-
exercise_id :Int
Unique ID. -
module :AtlasModule
The module to which the task belongs. -
title :String
Title of the task. -
content :String
Content of the task. -
description :String
Short description of the task. -
exercisePublic :Boolean
indication if task is public. -
avgRating :Float?
the average rating of the task, zero if no ratings. -
type :String?
type assigned to the task. -
tags :List<Tags>
List of tags associated with the task.
Submission containing a file. Database table: submissions_file
It contains the variables:
-
submission_id
: Foreign key to the submission containing this file, Primary key annotated with @Id -
file
: Int. Foreign key towards the linked asset
Submission containing plain text. Database table: submission_free
It contains the variables:
-
submission_id
: Foreign key to the submission containing this text. Primary key annotated with @Id -
content
: String with Submission content
Programming language a code submission can be in. Database Table: code_language
It contains the variables:
-
lang_id
: Primary key, annotated with @Id -
name
: String. Name of the programming language
Submission containing multiple choice questions.
It contains the Variables:
-
submission_id
the ID of the submission containing this solution
Not inside the default constructor:
-
questions
Array of MultipleChoiceQuestions, that contains the answered questions of this submission. Nullable, is filled later
Links a module with one or more Assets. Database table: module_assets
It contains the variables:
-
module_asset_id
: Primary key, annotated with @Id -
module_id
: Foreign key to the connected module -
asset_id
: Foreign key to the connected asset
Links a module with one or more links
It contains the Variables:
-
module_link_id
: Priamry key, annotated with @Id -
module_id
: Foreign key to the conntected module -
link
: String with the link
ModuleUser is a user returned when asked for a user in context to a module.
It contains the variables:
-
user_id :Int
ID of the AtlasUser. -
module_role :Role
the role a user takes in a module. -
name :String
the name of the user. -
username :String
the login username. -
email :String
the email of the user.
Answer to a multiple choice question. Database table mc_answer
It contains the variables:
-
answer_id
: Primary key, annotated with @Id -
content
: The text of this answer -
correct
: Says wether this answer is correct or not. Write only, is not given back to the frontend
Outside of the database / default constructor:
-
question_id
: ID of the question, that this question answers -
marked
: Boolean. Says wether this answer is marked in a submission
Question in a multiple choice exercise / submission
It contains the variables:
-
question_id
: Primary key, annotated with @Id -
content
: String. Content of the Question -
exercise_id
: Foreign key to the connected exercise
Outside of the database / default constructor:
-
answers
: List ofMultipleChoiceAnswer
. Nullable, is filled later
Notification is the notification as found in the database as table notification and labeled @Table("notification")
.
It contains the variables:
-
notification_id :Int
Unique ID. It is the primary key and is marked with@Id
. -
title :String
Title of the notification. -
content :String
Text content of the notification. -
time :Timestamp
Time when the notification was created. -
type_id :Int
the ID of the notification type. -
module_id :Int?
the id of the associated module, is Nullable. -
exercise_id :Int?
the Id of the associated task, is Nullable. -
submission_id :Int?
the Id of the associated submission, is Nullable.
NotificationRead is a notification that additionally contains the information for the requesting user whether he has already read the notification.
It contains the variables of Notification
and the variable read:
-
read :Boolean
truth value to indicate whether the notification has already been read.
Notification is the type of a notification, as found in the database as notification_type and marked with @Table("notification_type")
.
It contains the variables:
-
type_id :Int
Unique ID. It is the primary key and is marked with@Id
. -
name :String
Name/description of the type.
Rating is the rating of a task as found in the database as user_exercise_rating and marked with @Table("user_exercise_rating")
.
It contains the variables:
-
rating_id :Int
Unique ID. It is the primary key and is marked with@Id
. -
user_id :Int
the ID of the user who has rated. -
exercise_id :Int
the ID of the task that was rated. -
value :int
the value of the assessment.
Role is the role that can be assigned to a user, as found in the database as role and marked with @Table("role")
.
It contains the variables:
-
role_id :Int
Unique ID. It is the primary key and is marked with@Id
. ExtendsGrtantedAuthority
, which is part of Spring Security. -
name :String
Name of the role.
Submission is the submission of a user to a task, as found in the database as user_exercise_submission and marked with @Table("user_exercise_submission")
.
It contains the variables:
-
submission_id :Int
Unique ID. It is the primary key and is marked with@Id
. -
exercise_id
the ID of the task to which the submission belongs. -
user_id
the ID of the user who created the submission. -
upload_time
: Timestamp of the submission upload -
upload_time :Timestamp
the time when the submission was made. -
grade :Int?
the grade with which the submission was evaluated. -
teacher_id :Int?
the ID of the user/teacher who graded the submission. -
comment :String
a comment about the grading of the submission. -
type
: Foreign key to theSubmissionType
this submission is from
Outside the database / default constructor:
-
content
:SubmissionTemplate
. Content of the submission
SubmissionGrade is the grading of a submission, it has similar variables to Submission but only the variables for grading to make this easier to edit.
It contains the variables:
-
submission_id :Int
Unique ID. It is the primary key. -
grade :Int?
the grade with which the submission was graded. -
comment :String
a comment about the grading of the submission.
Represents the database table mc_submission
.
It contains the variables:
-
submission_id
: Foreign key to the submission containing this MC answer -
answer_id
: Foreign key to the answer inside this submission -
marked
: Boolean. Saves wether an answer is marked or not
Abstract superclass of McSubmission
, CodeSubmission
, FileSubmission
and FreeSubmission
. Annotates with @JsonTypeInfo to tell the JSON parser tp parse this class according to the value of the variable type
. What values this variable can have, and to what class the parser should parse the JSON is written inside the @JsonSubTypes annotation.
Type a submission can have. Database table: submission_type
It contains the variables:
-
type_id
: Primary key, annotated with @Id -
name
: String. Name of the type
Tag is the assignment tag as found in the database as tag and marked with @Table("tag")
.
It contains the variables:
-
tag_id :Int
Unique ID. It is the primary key and is marked with@Id
. -
name :String
Name of the tag -
icon_id :Int
Id of a Icon
TagRet is the Tag that we Return on requests. It contains everything from the Tag and the complete Icon instead of the icon_id
UserSettings are the settings that A User can make, as found in the database as user_settings and marked with @Table("user_settings")
.
They contain the variables:
-
user_id :Int
Unique ID. It is the primary key and is marked with@Id
. The ID of the user to which the settings belong. -
language :String
the selected language. -
theme :String
the selected theme.