Esempio n. 1
0
    def review_insert(self, request):
        my_items = ReviewMessageCollection(items=request.items)

        for rev in my_items.items:
            query = ReviewModel.query(ReviewModel.uuid == rev.uuid)

            if query.count() == 0:
                ReviewModel(
                    name=rev.name,
                    description=rev.description,
                    rating=rev.rating,
                    tags=rev.tags,
                    reviewobj_uuid=rev.revobj_uuid,
                    last_modified=date_to_utc(rev.last_modified),
                    date_created=date_to_utc(rev.date_created),
                    creator=rev.creator,
                    uuid=rev.uuid,
                    deleted=rev.deleted,
                ).put()
            else:
                review = query.get()

                review.name = rev.name
                review.description = rev.description
                review.rating = rev.rating
                review.tags = rev.tags
                review.reviewobj_uuid = rev.revobj_uuid
                review.last_modified = date_to_utc(rev.last_modified)
                review.date_created = date_to_utc(rev.date_created)
                review.creator = rev.creator
                review.deleted = rev.deleted

                review.put()

        return message_types.VoidMessage()
Esempio n. 2
0
    def review_list(self, unused_request):
        qry = ReviewModel.query()
        my_items = []

        for rev in qry:
            my_items.append(
                ReviewMessage(
                    name=rev.name,
                    description=rev.description,
                    rating=rev.rating,
                    tags=rev.tags,
                    revobj_uuid=rev.reviewobj_uuid,
                    last_modified=rev.last_modified,
                    date_created=rev.date_created,
                    creator=rev.creator,
                    uuid=rev.uuid,
                    deleted=rev.deleted,
                )
            )

        return ReviewMessageCollection(items=my_items)
Esempio n. 3
0
    def review_sync_down(self, request):
        query = ReviewModel.query(ReviewModel.last_modified > string_to_datetime(request.date))

        my_items = []

        for review in query:
            my_items.append(
                ReviewMessage(
                    name=review.name,
                    description=review.description,
                    rating=review.rating,
                    tags=review.tags,
                    last_modified=review.last_modified,
                    date_created=review.date_created,
                    creator=review.creator,
                    revobj_uuid=review.reviewobj_uuid,
                    uuid=review.uuid,
                    deleted=review.deleted,
                )
            )

        return ReviewMessageCollection(items=my_items)