# Path: auth/models.py
# def set_sqlite_pragma(dbapi_connection, connection_record):
# def generate_code():
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# def record_change(f):
#     def func(self, **kwargs):
#     def should_expire(self):
#     def should_end(self):
#     def megabytes_are_finished(self):
#     def time_left(self):
#     def end_at(self):
#     def extend(self):
#     def login(self):
#     def end(self):
#     def expire(self):
#     def block(self):
#     def unblock(self):
#     def archive(self):
#     def available_actions(self):
#     def __str__(self):
#     def matches_voucher(self, voucher):
#     def process_request(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# class Role(db.Model, RoleMixin):
# class User(db.Model, UserMixin):
# class Network(db.Model):
# class Gateway(db.Model):
# class Voucher(db.Model):
# class Auth(db.Model):
# class Change(db.Model):
# class Country(db.Model):
# class Currency(db.Model):
# class Category(db.Model):
# class Product(db.Model):
# class Order(db.Model):
# class OrderItem(db.Model):
# class Transaction(db.Model):


import errno
import flask
import os
from auth.models import Network, User, Gateway, Voucher, Category, Product, Country, Currency, db
from flask_potion import Api, fields, signals
from flask_potion.routes import Relation, Route, ItemRoute
from flask_potion.contrib.principals import PrincipalResource, PrincipalManager
from flask_security import current_user
from flask_uploads import UploadSet, IMAGES
from PIL import Image
            'delete': super_admin_only,
        }
        read_only_fields = ('created_at', 'updated_at', 'available_actions', 'time_left')

    class Schema:
        network = fields.ToOne('networks')
        gateway = fields.ToOne('gateways')
        available_actions = fields.String()
        time_left = fields.Integer()

    @ItemRoute.POST
    def extend(self, voucher):
        self.manager.extend(voucher)

    @ItemRoute.POST
    def block(self, voucher):
        self.manager.block(voucher)

    @ItemRoute.POST
    def unblock(self, voucher):
        self.manager.unblock(voucher)

    @ItemRoute.POST
    def archive(self, voucher):
        self.manager.archive(voucher)

class CategoryResource(PrincipalResource):
    class Meta:
        manager = Manager


# Path: auth/models.py
# def set_sqlite_pragma(dbapi_connection, connection_record):
# def generate_code():
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# def record_change(f):
#     def func(self, **kwargs):
#     def should_expire(self):
#     def should_end(self):
#     def megabytes_are_finished(self):
#     def time_left(self):
#     def end_at(self):
#     def extend(self):
#     def login(self):
#     def end(self):
#     def expire(self):
#     def block(self):
#     def unblock(self):
#     def archive(self):
#     def available_actions(self):
#     def __str__(self):
#     def matches_voucher(self, voucher):
#     def process_request(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# class Role(db.Model, RoleMixin):
# class User(db.Model, UserMixin):
# class Network(db.Model):
# class Gateway(db.Model):
# class Voucher(db.Model):
# class Auth(db.Model):
# class Change(db.Model):
# class Country(db.Model):
# class Currency(db.Model):
# class Category(db.Model):
# class Product(db.Model):
# class Order(db.Model):
# class OrderItem(db.Model):
# class Transaction(db.Model):


# Path: auth/resources.py
import errno
import flask
import os
from auth.models import Network, User, Gateway, Voucher, Category, Product, Country, Currency, db
from flask_potion import Api, fields, signals
from flask_potion.routes import Relation, Route, ItemRoute
from flask_potion.contrib.principals import PrincipalResource, PrincipalManager
from flask_security import current_user
from flask_uploads import UploadSet, IMAGES
from PIL import Image

            'delete': super_admin_only,
        }
        read_only_fields = ('created_at', 'updated_at', 'available_actions', 'time_left')

    class Schema:
        network = fields.ToOne('networks')
        gateway = fields.ToOne('gateways')
        available_actions = fields.String()
        time_left = fields.Integer()

    @ItemRoute.POST
    def extend(self, voucher):
        self.manager.extend(voucher)

    @ItemRoute.POST
    def block(self, voucher):
        self.manager.block(voucher)

    @ItemRoute.POST
    def unblock(self, voucher):
        self.manager.unblock(voucher)

    @ItemRoute.POST
    def archive(self, voucher):
        self.manager.archive(voucher)

class CategoryResource(PrincipalResource):
    class Meta:
        manager = Manager


        model = Category