Subversion Repositories SmartDukaan

Rev

Rev 16597 | Rev 16692 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16597 Rev 16631
Line 3... Line 3...
3
from elixir.entity import Entity
3
from elixir.entity import Entity
4
from elixir.fields import Field
4
from elixir.fields import Field
5
from elixir.options import using_options, using_table_options
5
from elixir.options import using_options, using_table_options
6
from sqlalchemy.sql.expression import func
6
from sqlalchemy.sql.expression import func
7
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, \
7
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, \
8
    Text
8
    Text, Date
9
from sqlalchemy.dialects.mysql.base import LONGTEXT
9
from sqlalchemy.dialects.mysql.base import LONGTEXT
10
 
10
 
11
CASHBACK_AMOUNT = 'CASHBACK_AMOUNT'
11
CASHBACK_AMOUNT = 'CASHBACK_AMOUNT'
12
CASHBACK_PERCENTAGE = 'CASHBACK_PERCENTAGE'
12
CASHBACK_PERCENTAGE = 'CASHBACK_PERCENTAGE'
13
class Users(Entity):
13
class Users(Entity):
Line 476... Line 476...
476
    customerOneLiner = Field(String(512))
476
    customerOneLiner = Field(String(512))
477
    retailerOneLiner = Field(String(512))
477
    retailerOneLiner = Field(String(512))
478
    using_options(shortnames=True)
478
    using_options(shortnames=True)
479
    using_table_options(mysql_engine="InnoDB")
479
    using_table_options(mysql_engine="InnoDB")
480
    
480
    
-
 
481
class approved_app_transactions(Entity):
-
 
482
    id = Field(Integer, primary_key=True, autoincrement=True)
-
 
483
    app_id = Field(Integer)
-
 
484
    retailer_id = Field(Integer)
-
 
485
    transaction_id = Field(String(100))
-
 
486
    transaction_time = Field(DateTime)
-
 
487
    redirect_url = Field(String(256))
-
 
488
    payout_status = Field(Integer)
-
 
489
    payout_description = Field(String(100))
-
 
490
    cashback_status = Field(Integer)
-
 
491
    cash_back_description = Field(String(100))
-
 
492
    payout_amount = Field(Integer)
-
 
493
    payout_time = Field(DateTime)
-
 
494
    offer_price = Field(Integer)
-
 
495
    overridenCashBack = Field(Integer)
-
 
496
    isCashBackOverriden = Field(Boolean)
-
 
497
    user_payout = Field(Integer)
-
 
498
    cashBackConsidered = Field(Boolean)
-
 
499
    using_options(shortnames=True)
-
 
500
    using_table_options(mysql_engine="InnoDB")
-
 
501
    
-
 
502
class user_app_cashbacks(Entity):
-
 
503
    user_id = Field(Integer)
-
 
504
    status = Field(String(30))
-
 
505
    amount = Field(Integer)
-
 
506
    fortnightOfYear = Field(Integer)
-
 
507
    yearVal = Field(Integer)
-
 
508
    using_options(shortnames=True)
-
 
509
    using_table_options(mysql_engine="InnoDB")
-
 
510
    
-
 
511
class user_app_installs(Entity):
-
 
512
    user_id = Field(Integer)
-
 
513
    fortnightOfYear = Field(Integer)
-
 
514
    transaction_date = Field(Date)
-
 
515
    app_id = Field(Integer)
-
 
516
    app_name = Field(String(256))
-
 
517
    installCount = Field(Integer)
-
 
518
    payoutAmount = Field(Integer)
-
 
519
    using_options(shortnames=True)
-
 
520
    using_table_options(mysql_engine="InnoDB")
-
 
521
    
-
 
522
class total_app_installs(Entity):
-
 
523
    app_id = Field(Integer)
-
 
524
    app_name = Field(String(256))
-
 
525
    date = Field(Date)
-
 
526
    totalPayoutAmount = Field(Integer)
-
 
527
    totalOfferAmount = Field(Integer)
-
 
528
    using_options(shortnames=True)
-
 
529
    using_table_options(mysql_engine="InnoDB")
-
 
530
    
481
    
531
    
482
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
532
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
483
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
533
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
484
    #metadata.bind = 'mysql://root:shop2020@localhost/catalog'
534
    #metadata.bind = 'mysql://root:shop2020@localhost/catalog'
485
    cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
535
    cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)