generated from CodeYourFuture/cyf-final-project-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 1
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
#27 and #34- store each suggestion with unique id and alter sentences table - Appolin Semegni Fotso #38
Merged
Merged
#27 and #34- store each suggestion with unique id and alter sentences table - Appolin Semegni Fotso #38
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8fa17e9
Refactored a new submitButton function and passed it as props to PopU…
AppolinFotso 223fac6
Added useState to SubmitSuggestion component to handle message after …
AppolinFotso 712a869
Passed message props to PopUpAlert to display the return message from…
AppolinFotso de1c0fb
Added callback function to onClick in PopUpAlert
AppolinFotso d319965
Added tenary operator in PopUpAlert to handle the return message from…
AppolinFotso f0a3c27
Added Alert component to handle unsaved suggestion
AppolinFotso 90b5bc2
Replaced URLSearchParams with jsonData in SubmitSuggestion component
AppolinFotso c13eea7
Added a for loop to store each suggestion with their unique id
AppolinFotso b6bb906
Updated the database schema
AppolinFotso 0a2930f
Removed the hardcoded text on the endpoint /api and added a query to …
AppolinFotso 15ead82
Added query to retrieve the sentence id from sentences table and stor…
AppolinFotso dd4d0f4
Update server/api.js
sztupy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
/* gla6-fp-team1 week 1 Investigate the database schema ticket*/ | ||
|
||
sentences { | ||
id INT PK, | ||
sentence TEXT, | ||
source TEXT, | ||
count INT | ||
|
||
} | ||
|
||
sentences--0NE ||--MANY{ suggesions : have} | ||
|
||
suggesions { | ||
id INT PK, | ||
sentence_id INT REFERENCES sentences(id), | ||
suggestion TEXT | ||
|
||
} | ||
suggesions --ONE || --ONE { sentence : correspond to} | ||
user_interactions{ | ||
id SERIAL PRIMARY KEY, | ||
sentence_id INTEGER REFERENCES sentences(id), | ||
selected_suggestion TEXT, | ||
user_provided_suggestion TEXT | ||
} | ||
user_interactions --ONE || ONE {sentence : correspond to} | ||
CREATE TABLE sentences ( | ||
id SERIAL PRIMARY KEY, | ||
sentence TEXT | ||
); | ||
CREATE TABLE suggestions ( | ||
id SERIAL PRIMARY KEY, | ||
sentence_id INTEGER REFERENCES sentences(id), | ||
suggestion TEXT | ||
); | ||
CREATE TABLE user_interactions ( | ||
id SERIAL PRIMARY KEY, | ||
sentence_id INTEGER REFERENCES sentences(id), | ||
selected_suggestion TEXT, | ||
user_provided_suggestion TEXT | ||
); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whenever you update the schema it is also customary to provide update scripts - otherwise people will need to delete and re-create the database from scratch. This is not a problem right now, but could become an issue in the future once the project is live
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we should provide some test data - a couple of INSERT INTOs of the existing sentence data for example to make sure we have enough data to start with. Something like