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 :IntUnique ID. It is the primary key and is marked with@Id. -
name :Stringthe name of the module. -
description: Stringa short description of the module. -
modulePublic: BooleanAssigns whether the module is public, with annotation @field:Column("public") to the database. -
icon_id :IntId 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 :IntUnique ID. It is the primary key and is marked with@Id. -
name :Stringthe user's name. -
username :Stringthe login username. -
email :Stringthe users email. -
(private) password :Stringvalue for user's password.
In addition to database variables:
-
roles :MutableCollection<Role> = mutableListOflist 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 :IntUnique ID. It is the primary key and is marked with@Id. -
module_id :IntID of the module to which the exercise belongs. -
type_id :IntID of the type to which the task is assigned. -
title :StringTitle of the task. -
content :StringContent of the task. -
description :Stringshort description of the task. -
exercisePublic :BooleanAssigns 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 :IntUnique ID. -
module :AtlasModuleThe module to which the task belongs. -
title :StringTitle of the task. -
content :StringContent of the task. -
description :StringShort description of the task. -
exercisePublic :Booleanindication 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_idthe ID of the submission containing this solution
Not inside the default constructor:
-
questionsArray 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 :IntID of the AtlasUser. -
module_role :Rolethe role a user takes in a module. -
name :Stringthe name of the user. -
username :Stringthe login username. -
email :Stringthe 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 :IntUnique ID. It is the primary key and is marked with@Id. -
title :StringTitle of the notification. -
content :StringText content of the notification. -
time :TimestampTime when the notification was created. -
type_id :Intthe 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 :Booleantruth 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 :IntUnique ID. It is the primary key and is marked with@Id. -
name :StringName/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 :IntUnique ID. It is the primary key and is marked with@Id. -
user_id :Intthe ID of the user who has rated. -
exercise_id :Intthe ID of the task that was rated. -
value :intthe 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 :IntUnique ID. It is the primary key and is marked with@Id. ExtendsGrtantedAuthority, which is part of Spring Security. -
name :StringName 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 :IntUnique ID. It is the primary key and is marked with@Id. -
exercise_idthe ID of the task to which the submission belongs. -
user_idthe ID of the user who created the submission. -
upload_time: Timestamp of the submission upload -
upload_time :Timestampthe 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 :Stringa comment about the grading of the submission. -
type: Foreign key to theSubmissionTypethis 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 :IntUnique ID. It is the primary key. -
grade :Int?the grade with which the submission was graded. -
comment :Stringa 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 :IntUnique ID. It is the primary key and is marked with@Id. -
name :StringName of the tag -
icon_id :IntId 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 :IntUnique ID. It is the primary key and is marked with@Id. The ID of the user to which the settings belong. -
language :Stringthe selected language. -
theme :Stringthe selected theme.