-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#22/review api
- Loading branch information
Showing
25 changed files
with
402 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
from .airport import * | ||
from .user import * | ||
from .dog import * | ||
from .organization import * | ||
from .airport_model import * | ||
from .user_model import * | ||
from .dog_model import * | ||
from .organization_model import * | ||
|
||
from .user_review_model import * | ||
from .organization_review_model import * |
File renamed without changes.
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,11 @@ | ||
from djongo import models | ||
from server.models import BaseUser, Organization | ||
|
||
|
||
class OrganizationReview(models.Model): | ||
_id = models.ObjectIdField(primary_key=True) | ||
comment = models.CharField(max_length=500) | ||
image = models.CharField(max_length=500, default="") | ||
createdAt = models.DateField(auto_now_add=True) | ||
organization = models.EmbeddedField(model_container=Organization) | ||
user = models.EmbeddedField(model_container=BaseUser) |
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,13 @@ | ||
from djongo import models | ||
from server.models import BaseUser, AbstractOrganization | ||
|
||
|
||
class UserReview(models.Model): | ||
_id = models.ObjectIdField(primary_key=True) | ||
comment = models.CharField(max_length=500) | ||
image = models.CharField(max_length=1000, default="") | ||
createdAt = models.DateField(auto_now_add=True) | ||
organization = models.EmbeddedField(model_container=AbstractOrganization) | ||
user = models.EmbeddedField(model_container=BaseUser) | ||
|
||
objects = models.DjongoManager() |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from .airport import * | ||
from .user import * | ||
from .dog import * | ||
from .airport_serializer import * | ||
from .user_serializer import * | ||
from .organization_serializer import * | ||
from .dog_serializer import * | ||
from .review_serializer import * |
File renamed without changes.
File renamed without changes.
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,8 @@ | ||
from rest_framework import serializers | ||
from server.models import Organization | ||
|
||
|
||
class OrganizationSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Organization | ||
fields = "__all__" |
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 @@ | ||
from rest_framework import serializers | ||
from server.models import UserReview, OrganizationReview | ||
from server.serializers import * | ||
|
||
|
||
class UserReviewSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = UserReview | ||
fields = "__all__" | ||
|
||
|
||
class OrganizationReviewSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = OrganizationReview | ||
fields = "__all__" |
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,13 @@ | ||
import json | ||
from bson import ObjectId | ||
|
||
|
||
class JSONEncoder(json.JSONEncoder): | ||
def default(self, o): | ||
if isinstance(o, ObjectId): | ||
return str(o) | ||
return json.JSONEncoder.default(self, o) | ||
|
||
|
||
def jsonify(data): | ||
return json.loads(json.dumps(data, cls=JSONEncoder)) |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .airport import * | ||
from .user import * | ||
from .dog import * | ||
from .review import * |
Oops, something went wrong.