# MongoDB Configuration

MONGO_HOST = 'localhost'
MONGO_PORT = 27017
MONGO_USERNAME = 'api'
MONGO_PASSWORD = 'api'
MONGO_DBNAME = 'api-bench'

# API
RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']

# /teams
teams = {
    # allow teams to be modified
    'resource_methods': ['GET', 'POST'],
    # allow teams to be retrieved by name
    'additional_lookup': {
        'url': 'regex("[\w]+")',
        'field': 'name',
        },
    # what a team looks like in mongodb
    'schema': {
        'name': {
            'type': 'string',
            'minlength': 3,
            'maxlength': 10,
            'unique': True,
            },
        'points': {
            'type': 'integer',
            },
        },
    }

# /coupons
coupons = {
    # allow users to be modified
    'resource_methods': ['GET', 'POST'],
    # what a user looks like in mongodb
    'schema': {
        'hash': {
            'type': 'string',
            'minlength': 3,
            'maxlength': 10,
            'unique': True,
        },
        'name': {
            'type': 'list',
            'allowed': ['participant', 'guest', 'admin']
        },
        'validated_by': {
            'iscoupon': True,
            'type': 'objectid',
            'data_relation': {
                'resource': 'teams',
                'field': '_id',
            },
        },
    },
}

# /users
users = {
    # allow users to be modified
    'resource_methods': ['GET', 'POST'],
    # allow users to be retrieved by name
    'additional_lookup': {
        'url': 'regex("[\w]+")',
        'field': 'login',
        },
    # what a user looks like in mongodb
    'schema': {
        'login': {
            'type': 'string',
            'minlength': 3,
            'maxlength': 10,
            'unique': True,
            },
        'role': {
            'type': 'list',
            'allowed': ['participant', 'guest', 'admin']
            },
        'team': {
            'type': 'objectid',
            'data_relation': {
                'resource': 'teams',
                'field': '_id',
                },
            },
        'token': {
            'type': 'string',
            'required': True,
        },    
    }
}

DOMAIN = {
    'users': users,
    'teams': teams,
    'coupons': coupons,
    }

84763846c3c0e91b7612bd640cac064f3fd6e0a8
<mask token>

MONGO_HOST = 'localhost'
MONGO_PORT = 27017
MONGO_USERNAME = 'api'
MONGO_PASSWORD = 'api'
MONGO_DBNAME = 'api-bench'
RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']
teams = {'resource_methods': ['GET', 'POST'], 'additional_lookup': {'url':
    'regex("[\\w]+")', 'field': 'name'}, 'schema': {'name': {'type':
    'string', 'minlength': 3, 'maxlength': 10, 'unique': True}, 'points': {
    'type': 'integer'}}}
coupons = {'resource_methods': ['GET', 'POST'], 'schema': {'hash': {'type':
    'string', 'minlength': 3, 'maxlength': 10, 'unique': True}, 'name': {
    'type': 'list', 'allowed': ['participant', 'guest', 'admin']},
    'validated_by': {'iscoupon': True, 'type': 'objectid', 'data_relation':
    {'resource': 'teams', 'field': '_id'}}}}
users = {'resource_methods': ['GET', 'POST'], 'additional_lookup': {'url':
    'regex("[\\w]+")', 'field': 'login'}, 'schema': {'login': {'type':
    'string', 'minlength': 3, 'maxlength': 10, 'unique': True}, 'role': {
    'type': 'list', 'allowed': ['participant', 'guest', 'admin']}, 'team':
    {'type': 'objectid', 'data_relation': {'resource': 'teams', 'field':
    '_id'}}, 'token': {'type': 'string', 'required': True}}}
DOMAIN = {'users': users, 'teams': teams, 'coupons': coupons}

# MongoDB Configuration

MONGO_HOST = 'localhost'
MONGO_PORT = 27017
MONGO_USERNAME = 'api'
MONGO_PASSWORD = 'api'
MONGO_DBNAME = 'api-bench'

# API
RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']

# /teams
teams = {
    # allow teams to be modified
    'resource_methods': ['GET', 'POST'],
    # allow teams to be retrieved by name
    'additional_lookup': {
        'url': 'regex("[\w]+")',
        'field': 'name',
        },
    # what a team looks like in mongodb
    'schema': {
        'name': {
            'type': 'string',
            'minlength': 3,
            'maxlength': 10,
            'unique': True,
            },
        'points': {
            'type': 'integer',
            },
        },
    }

# /coupons
coupons = {
    # allow users to be modified
    'resource_methods': ['GET', 'POST'],
    # what a user looks like in mongodb
    'schema': {
        'hash': {
            'type': 'string',
            'minlength': 3,
            'maxlength': 10,
            'unique': True,
        },
        'name': {
            'type': 'list',
            'allowed': ['participant', 'guest', 'admin']
        },
        'validated_by': {
            'iscoupon': True,
            'type': 'objectid',
            'data_relation': {
                'resource': 'teams',
                'field': '_id',
            },
        },
    },
}

# /users
users = {
    # allow users to be modified
    'resource_methods': ['GET', 'POST'],
    # allow users to be retrieved by name
    'additional_lookup': {
        'url': 'regex("[\w]+")',
        'field': 'login',
        },
    # what a user looks like in mongodb
    'schema': {
        'login': {
            'type': 'string',
            'minlength': 3,
            'maxlength': 10,
            'unique': True,
            },
        'role': {
            'type': 'list',
            'allowed': ['participant', 'guest', 'admin']
            },
        'team': {
            'type': 'objectid',
            'data_relation': {
                'resource': 'teams',
                'field': '_id',
                },
            },
        'token': {
            'type': 'string',
            'required': True,
        },    
    }
}

DOMAIN = {
    'users': users,
    'teams': teams,
    'coupons': coupons,
    }
