예제 #1
0
    def comment_sync_down(self, request):
        """
			metoda koja ce vratiti sve komentare koji su dodati/menjani nakon proteglov
			vremena od poslednje sinhronizacije:
			
			Args:
				StringMessage (type): messages.Message 
				vreme poslednje sinhronizacije u %Y-%m-%dT%H:%M:%S formatu
				
			Returns:
				CommentMessageCollection (type): messages.Message 
				Izlazna poruka koja se salje klijentima
		"""

        query = CommentModel.query(CommentModel.last_modified > string_to_datetime(request.date))

        my_items = []

        for comment in query:
            my_items.append(
                CommentMessage(
                    content=comment.content,
                    creator=comment.creator,
                    review_uuid=comment.review_uuid,
                    uuid=comment.uuid,
                    last_modified=comment.last_modified,
                )
            )

        return CommentMessageCollection(items=my_items)
예제 #2
0
    def comment_list(self, unused_request):
        qry = CommentModel.query()
        my_items = []

        for comment in qry:
            my_items.append(
                CommentMessage(
                    content=comment.content,
                    last_modified=comment.last_modified,
                    creator=comment.creator,
                    uuid=comment.uuid,
                    review_uuid=comment.review_uuid,
                )
            )

        return CommentMessageCollection(items=my_items)