-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: save results tables in the Django app
Add a Results model to the Django app, and save results tables.
- Loading branch information
1 parent
66b6b46
commit f4c0e87
Showing
15 changed files
with
650 additions
and
22 deletions.
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,29 @@ | ||
import { useSelector } from "react-redux"; | ||
|
||
import { RootState } from "../../app/store"; | ||
import { | ||
useResultsCreateMutation, | ||
useResultsDestroyMutation, | ||
useResultsListQuery, | ||
useResultsUpdateMutation, | ||
} from "../../app/backendApi"; | ||
|
||
export function useResults() { | ||
const projectId = useSelector( | ||
(state: RootState) => state.main.selectedProject, | ||
); | ||
const projectIdOrZero = projectId || 0; | ||
const { data: results } = useResultsListQuery( | ||
{ projectId: projectIdOrZero }, | ||
{ skip: !projectId }, | ||
); | ||
const [updateResults] = useResultsUpdateMutation(); | ||
const [createResults] = useResultsCreateMutation(); | ||
const [deleteResults] = useResultsDestroyMutation(); | ||
return { | ||
results: results || [], | ||
updateResults, | ||
createResults, | ||
deleteResults, | ||
}; | ||
} |
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,15 @@ | ||
# | ||
# This file is part of PKPDApp (https://github.com/pkpdapp-team/pkpdapp) which | ||
# is released under the BSD 3-clause license. See accompanying LICENSE.md for | ||
# copyright notice and full license details. | ||
# | ||
|
||
from rest_framework import serializers | ||
from pkpdapp.models import Results | ||
|
||
|
||
class ResultsSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = Results | ||
fields = '__all__' |
Oops, something went wrong.