offers data
This commit is contained in:
@@ -19,3 +19,58 @@ ALTER TABLE ONLY demo_bank_accounts
|
|||||||
ADD CONSTRAINT demo_bank_accounts_id_key UNIQUE (id);
|
ADD CONSTRAINT demo_bank_accounts_id_key UNIQUE (id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE loan_offers (
|
||||||
|
id SERIAL,
|
||||||
|
uid uuid DEFAULT uuid_generate_v4(),
|
||||||
|
loan VARCHAR(25) UNIQUE NOT NULL,
|
||||||
|
amount INT DEFAULT 0,
|
||||||
|
description VARCHAR(125),
|
||||||
|
days_duration INT DEFAULT 0,
|
||||||
|
active INT DEFAULT 1,
|
||||||
|
lorder INT DEFAULT 0,
|
||||||
|
score INT DEFAULT 0,
|
||||||
|
added timestamp without time zone DEFAULT now()
|
||||||
|
);
|
||||||
|
ALTER TABLE ONLY loan_offers
|
||||||
|
ADD CONSTRAINT loan_offers_id_key UNIQUE (id);
|
||||||
|
|
||||||
|
INSERT INTO loan_offers (
|
||||||
|
loan, amount, description, days_duration
|
||||||
|
) VALUES (
|
||||||
|
'LOAN001',
|
||||||
|
100000,
|
||||||
|
'100,000 Naira for 30 Days',
|
||||||
|
30
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO loan_offers (
|
||||||
|
loan, amount, description, days_duration
|
||||||
|
) VALUES (
|
||||||
|
'LOAN002',
|
||||||
|
300000,
|
||||||
|
'300,000 Naira for 60 Days',
|
||||||
|
60
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO loan_offers (
|
||||||
|
loan, amount, description, days_duration
|
||||||
|
) VALUES (
|
||||||
|
'LOAN003',
|
||||||
|
900000,
|
||||||
|
'900,000 Naira for 90 Days',
|
||||||
|
90
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce00", "description": "100,000 Naira for 30 Days" , "active" : 1 },
|
||||||
|
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce01", "description": "300,000 Naira for 60 Days" , "active" : 1 },
|
||||||
|
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce02", "description": "900,000 Naira for 90 Days" , "active" : 1 },
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
{"cid": "1", "description": "Product Loan 01" , "active" : 0 },
|
||||||
|
{"cid": "2", "description": "Product Loan 02" , "active" : 0 },
|
||||||
|
{"cid": "3", "description": "First Advance" , "active" : 1 },
|
||||||
+15
-6
@@ -239,12 +239,21 @@ def products():
|
|||||||
|
|
||||||
|
|
||||||
def offers():
|
def offers():
|
||||||
offers_data = [
|
OFFER_QUERY = "SELECT uid AS cid,loan,amount,description,days_duration,active FROM loan_offers ORDER BY amount ASC"
|
||||||
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce00", "description": "100,000 Naira for 30 Days" , "active" : 1 },
|
with connection:
|
||||||
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce01", "description": "300,000 Naira for 60 Days" , "active" : 1 },
|
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||||
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce02", "description": "900,000 Naira for 90 Days" , "active" : 1 },
|
cursor.execute(OFFER_QUERY)
|
||||||
]
|
select_demoS = cursor.fetchall()
|
||||||
return offers_data
|
|
||||||
|
demo_data = json.dumps( [dict(ix) for ix in select_demoS] )
|
||||||
|
return json.loads( demo_data)
|
||||||
|
#
|
||||||
|
# offers_data = [
|
||||||
|
# {"cid": "425611f2-c692-4404-b93d-76ca7a5ce00", "description": "100,000 Naira for 30 Days" , "active" : 1 },
|
||||||
|
# {"cid": "425611f2-c692-4404-b93d-76ca7a5ce01", "description": "300,000 Naira for 60 Days" , "active" : 1 },
|
||||||
|
# {"cid": "425611f2-c692-4404-b93d-76ca7a5ce02", "description": "900,000 Naira for 90 Days" , "active" : 1 },
|
||||||
|
# ]
|
||||||
|
# return offers_data
|
||||||
|
|
||||||
|
|
||||||
def offers_detail(offer_id):
|
def offers_detail(offer_id):
|
||||||
|
|||||||
Reference in New Issue
Block a user