-
Notifications
You must be signed in to change notification settings - Fork 1
Code Review Suggestions - Motakean #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,4 +14,7 @@ interface MedicineDAO { | |
|
|
||
| @Query("DELETE FROM Medicine") | ||
| suspend fun deleteAll() | ||
| } | ||
|
|
||
| @Delete | ||
| suspend fun delete(medicine: Medicine) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of using @query and deleteall, we can use a simple @delete and delete method to make the code more clear and concise. Source: https://developer.android.com/training/data-storage/room/accessing-data There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This same suggestion appeared in a previously submitted code review. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,13 +3,21 @@ package com.medmapper.v33001.dto | |
| import androidx.room.ColumnInfo | ||
| import androidx.room.Entity | ||
| import androidx.room.PrimaryKey | ||
|
|
||
| /** | ||
| * A data class representing Medicine | ||
| * | ||
| * @property name; the name of the medicine | ||
| * @property strength; the strength of the medicine | ||
| * @property start_date; the date the patient started the medicine | ||
| * @property preciscription_length; how long the patient should take the medicine | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added kdoc documention to better help the functionality of the data class. |
||
| * | ||
| */ | ||
| @Entity(tableName = "Medicine") | ||
| data class Medicine( | ||
| @PrimaryKey(autoGenerate = true) val medID: Int, | ||
| @ColumnInfo(name = "name") val name: String?, | ||
| @ColumnInfo(name = "strength") val strength: String?, | ||
| @ColumnInfo(name = "start date") val startDate: String?, | ||
| @ColumnInfo(name = "prescription length") val lengthInDays: Int | ||
| @ColumnInfo(name = "start_date") val startDate: String?, | ||
| @ColumnInfo(name = "prescription_length") val lengthInDays: Int | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's important to seperate the column names with a "_" inbetween. source: https://developer.android.com/training/data-storage/room/defining-data |
||
| //,@ColumnInfo() val endDate: Date = startDate | ||
| ) | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.