Example #1
0
class FunfConfigResource(MongoDBResource):

    id = fields.CharField(attribute="_id")
    name = fields.CharField(attribute="name", blank=False, null=False)
    config = fields.DictField(attribute="config", blank=False, null=False)

    class Meta:
        resource_name = "funfconfig"
        list_allowed_methods = ["delete", "get", "post"]
        authentication = OAuth2Authentication("funf_write")
        authorization = PDSAuthorization(scope="funf_write",
                                         audit_enabled=True)
        object_class = Document
        collection = "funfconfig"  # collection name
Example #2
0
class IncidentResource(MongoDBResource):
    id = fields.CharField(attribute="_id")
    type = fields.CharField(attribute="type", null=False)
    date = fields.DateTimeField(attribute="date", null=False)
    description = fields.CharField(attribute="description", null=False)
    location = fields.DictField(attribute="location", null=False)
    user_reported = fields.BooleanField(attribute="user_reported", null=False)
    source = fields.CharField(attribute="source", null=False)

    class Meta:
        authentication = OAuth2Authentication("crowdsos_write")
        authorization = PDSAuthorization(scope="crowdsos_write",
                                         audit_enabled=False)
        resource_name = "incident"
        list_allowed_methods = ["delete", "get", "post"]
        object_class = Document
        collection = "incident"
        filtering = {"type": ["exact"]}
Example #3
0
class AnswerResource(MongoDBResource):
    id = fields.CharField(attribute="_id",
                          help_text='A guid identifier for an answer entry.')
    key = fields.CharField(
        attribute="key",
        help_text='A unique string to identify each answer.',
        null=False,
        unique=True)
    value = fields.DictField(
        attribute="value",
        help_text='A json blob of answer data.',
        null=True,
    )

    class Meta:
        resource_name = "answer"
        list_allowed_methods = ["delete", "get", "post"]
        help_text = 'resource help text...'
        authentication = OAuth2Authentication("funf_write")
        authorization = PDSAuthorization(scope="funf_write",
                                         audit_enabled=True)
        object_class = Document
        collection = "answer"  # collection name