Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
21_22-J 38
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
21_22-J 38
21_22-J 38
Commits
de63baba
Commit
de63baba
authored
Jan 07, 2022
by
W.D.R.P. Sandeepa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change color interface
parent
7cd23448
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
0 deletions
+44
-0
API/app.py
API/app.py
+12
-0
API/db/__pycache__/dbConnection.cpython-39.pyc
API/db/__pycache__/dbConnection.cpython-39.pyc
+0
-0
API/db/dbConnection.py
API/db/dbConnection.py
+23
-0
API/model/__pycache__/colorModel.cpython-39.pyc
API/model/__pycache__/colorModel.cpython-39.pyc
+0
-0
API/model/colorModel.py
API/model/colorModel.py
+9
-0
No files found.
API/app.py
View file @
de63baba
from
flask
import
Flask
,
redirect
,
url_for
,
render_template
,
request
,
jsonify
,
make_response
from
API.model.colorModel
import
get_color_activities
from
API.routers.router
import
funtion_one
app
=
Flask
(
__name__
)
# Initial Route
@
app
.
route
(
"/"
)
def
home
():
return
render_template
(
'home.html'
)
# Color Function Route (IT18218640)
@
app
.
route
(
"/getColorActivities"
)
def
getColorActivities
():
return
get_color_activities
()
# Read Function Route (IT)
@
app
.
route
(
"/testings"
)
def
checkothers
():
return
"testing funtions"
...
...
API/db/__pycache__/dbConnection.cpython-39.pyc
View file @
de63baba
No preview for this file type
API/db/dbConnection.py
View file @
de63baba
import
mysql.connector
from
sqlalchemy
import
create_engine
import
pandas
as
pd
from
flask
import
jsonify
import
json
from
API.routers.dic_config
import
create_dict
...
...
@@ -21,6 +22,26 @@ def create_con_pandas():
db
=
create_engine
(
db_connection_str
)
return
db
def
get_all_data
(
query
):
data_dic
=
[]
db
=
create_con
()
cursor
=
db
.
cursor
()
cursor
.
execute
(
query
)
result
=
cursor
.
fetchall
()
for
row
in
result
:
ob
=
{
"idcolorActivities"
:
row
[
0
],
"name"
:
row
[
1
],
"file"
:
row
[
2
],
"des"
:
row
[
3
],
"color"
:
row
[
4
],
}
data_dic
.
append
(
ob
)
return
jsonify
(
data_dic
)
def
insert_data_pandas_df
(
pd_df
,
table_name
):
db
=
create_con_pandas
()
...
...
@@ -40,6 +61,7 @@ def insert_data_json(sql_query):
db
.
close
()
return
"INFO: insert successful"
def
getDatas
(
query
):
data_dic
=
create_dict
()
db
=
create_con
()
...
...
@@ -57,6 +79,7 @@ def getDatas(query):
return
stud_json
def
insert_data
(
sql_query
):
db
=
create_con
()
cursor
=
db
.
cursor
()
...
...
API/model/__pycache__/colorModel.cpython-39.pyc
0 → 100644
View file @
de63baba
File added
API/model/colorModel.py
View file @
de63baba
from
API.db.dbConnection
import
get_all_data
def
get_color_activities
():
qry
=
'SELECT * FROM coloractivities'
response
=
get_all_data
(
qry
)
return
response
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment