示例#1
0
class Estabelecimento(db.Document):

    nome = db.StringField(max_length=50, required=True)
    telefone = db.StringField(max_length=20, required=True, unique=True)
    perfil_origem = StringEnumField(PerfilOrigemEnum)
    perfil_movimento = StringEnumField(PerfilMovimentacaoEnum)
    perfil_tipo = StringEnumField(PerfilTipoEnum)
    latitude = db.IntField(max_length=50, required=True, unique=True)
    longitude = db.IntField(max_length=50, required=True, unique=True)
    endereco = db.StringField(max_length=50, required=True)
    cnpj = db.StringField(max_length=50, required=True, unique=True)
    consumidores_visitados = db.IntField()
    google_rating = db.IntField()
    google_rating_total = db.IntField()
    regra_fumante = StringEnumField(RegraFumanteEnum)
    level_preco = db.IntField()
    qrcode_token = db.StringField(max_length=30, unique=True)
    vendas = db.IntField()
    create_at = db.DateTimeField()
    modified_at = db.DateTimeField(default=datetime.now)
    lista_consumidores = db.ListField(db.ReferenceField("Consumidor"))
    itens_vendidos = db.ListField(db.ReferenceField("Pagamento"))
    cupom = db.ListField(db.EmbeddedDocumentField("Cupom"))
    estoque = db.ListField(db.EmbeddedDocumentField("Estoque"))

    meta = {'ordering': ['create_at'], 'collection': 'estabelecimento'}
示例#2
0
class Pagamento(db.Document):

    cliente = db.ReferenceField('Consumidor', reverse_delete_rule=db.CASCADE)
    estabelecimento = db.ReferenceField('Estabelecimento',
                                        reverse_delete_rule=db.CASCADE)
    valor = db.IntField(required=True)
    status = StringEnumField(StatusEnum)
    modo = StringEnumField(ModoEnum)
    voucher = db.StringField(max_length=100)
    create_at = db.DateTimeField()
    modified_at = db.DateTimeField(default=datetime.now)

    meta = {'ordering': ['create_at'], 'collection': 'pagamento'}
示例#3
0
class Cupom(db.EmbeddedDocument):

    nome = db.StringField(max_length=100, required=True)
    desconto = db.IntField(required=True)
    ativo = StringEnumField(AtivoEnum)
    total_usado = db.IntField(default=0)
    create_at = db.DateTimeField()
    modified_at = db.DateTimeField(default=datetime.now)

    meta = {'ordering': ['create_at'], 'collection': 'cupom'}
示例#4
0
文件: mongoo.py 项目: hiqlabs/mongoo
class housekeep(meng.Document):
    start = meng.DynamicField(primary_key=True)
    end = meng.DynamicField()
    total = meng.IntField()  # total # of entries to do
    good = meng.IntField(default=0)  # entries successfully processed
    bad = meng.IntField(
        default=0)  # entries we failed to process to completion
    log = meng.ListField(
    )  # log of misery -- each item a failed processing incident
    state = StringEnumField(hkstate, default='open')
    git = meng.StringField(
    )  # git commit of this version of source_destination
    tstart = meng.DateTimeField()  # Time when job started
    time = meng.DateTimeField()  # Time when job finished
    meta = {'indexes': ['state', 'time']}
示例#5
0
class Step(Document):
    meta = {
        'indexes': [
            ('owner', 'status'),
            ('owner', 'key'),
        ],
    }

    owner = fields.ReferenceField(User, required=True)
    name = fields.StringField(require=True)
    description = fields.StringField(require=True)
    key = fields.StringField(require=True)
    status = StringEnumField(StepStatus,
                             require=True,
                             default=StepStatus.UNDECIDED)

    # List of step keys blocking this one
    is_blocked_by = fields.ListField(fields.StringField)
    # List of plugins linked to this task
    plugins = fields.ListField(fields.StringField)
    user_answer = fields.DictField()
示例#6
0
class Consumidor(db.Document):

    nome = db.StringField(max_length=50, required=True)
    telefone = db.StringField(max_length=20, required=True, unique=True)
    gastos_origem = StringEnumField(GostoOrigemEnum,
                                    default=GostoOrigemEnum.japonesa)
    gosto_movimentacao = StringEnumField(GostoMovimentacaoEnum)
    gosto_tipo = StringEnumField(GostoTipoEnum)
    estabelecimento_visitados = db.IntField()
    fumante = StringEnumField(FumanteEnum)
    renda = StringEnumField(RendaEnum)
    alcoolismo = StringEnumField(AlcoolismoEnum)
    create_at = db.DateTimeField()
    modified_at = db.DateTimeField(default=datetime.now)

    meta = {'ordering': ['create_at'], 'collection': 'consumidor'}
示例#7
0
class Workflow(Document):
    meta = {
        'indexes': [
            'owner',
        ],
    }

    owner = fields.ReferenceField(User, require=True)
    name = fields.StringField(required=True)
    status = StringEnumField(WorkflowStatus,
                             require=True,
                             default=WorkflowStatus.IN_PROGRESS)

    def get_steps_by_status(self, status):
        return Step.objects(owner=self.owner, status=status)

    @property
    def steps(self):
        steps = {}
        for status in StepStatus:
            steps[status.name] = self.get_steps_by_status(status)
        return steps
示例#8
0
 class Doc(Document):
     string_enum = StringEnumField(StringEnum, default=StringEnum.FIRST)
     int_enum = IntEnumField(IntEnum, default=IntEnum.FIRST)