Skip to content

Commit

Permalink
Hotfix 1.0.1 🔧 - Fix misaligned Profile and User id (#217)
Browse files Browse the repository at this point in the history
* Change user serializer to show profile id

* Change profile page to use profile id not user id

* Bump version
  • Loading branch information
JeronimoMendes authored May 30, 2022
1 parent 9739b68 commit 2610cb7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion backend/api/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ class UserSerializer(serializers.ModelSerializer):
username = serializers.ReadOnlyField()
mod = serializers.BooleanField(source="is_staff")
admin = serializers.BooleanField(source="is_superuser")
profile = serializers.IntegerField(source='profile.id')

class Meta:
model = User
fields = ("id", "username", "email", "mod", "admin")
fields = ("id", "profile", "username", "email", "mod", "admin")

def get_profile(self):
profile = Profile.objects.get(user=self.id)

class XPEventSerializer(serializers.ModelSerializer):
class Meta:
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"scripts": {
"start": "react-scripts start",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/ProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const ProfilePage = () => {

useEffect(() => {
getUser((res1) => {
getProfile(res1.data.id, (res2) => {
getXpEvents(res1.data.id, (res3) => {
getProfile(res1.data.profile, (res2) => {
getXpEvents(res1.data.profile, (res3) => {
setXpEvents(res3.data);
setLoading(false);
});
Expand Down

0 comments on commit 2610cb7

Please sign in to comment.