Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1206/jy #28

Open
wants to merge 20 commits into
base: 1216/ym
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

# production
/build
/flask-server/__pycache__/
/flask-server/static/react/

# misc
.DS_Store
Expand All @@ -21,3 +23,4 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

Binary file removed flask-server/__pycache__/app.cpython-39.pyc
Binary file not shown.
Binary file removed flask-server/__pycache__/database.cpython-310.pyc
Binary file not shown.
Binary file removed flask-server/__pycache__/database.cpython-311.pyc
Binary file not shown.
Binary file removed flask-server/__pycache__/database.cpython-39.pyc
Binary file not shown.
12 changes: 11 additions & 1 deletion flask-server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys
import string
import random
import hashlib



Expand Down Expand Up @@ -96,12 +97,12 @@ def Submit_Review(storename):
##################### Get data from DB #####################
@app.route("/get_registered_store/<storename>")
def get_registered_store(storename):
# avg=DB.AverageScore(storename)
registered = DB.get_store_byname(storename)
print(registered)
registered_json = json.dumps(registered)
return registered_json


#맛집목록조회 / 리액트에 json으로 보내주고 리액트에 proxy 추가...?
@app.route("/StoreListView_send_data", methods=['GET','POST'])
def list_stores():
Expand Down Expand Up @@ -133,6 +134,15 @@ def list_review(storename):
reviewdata = DB.get_review(storename) #read the table
menudatajson = json.dumps(reviewdata)
return menudatajson
@app.route("/Review_send_data",methods=['GET'])
def list_reviews():
all_reviews=DB.get_all_review()
reviewjson=json.dumps(all_reviews)
return reviewjson
# def make_average():
# stores=DB.get_store
# for store in stores:
# avg=DB.AverageScore(store)

#이미지 불러오기 함수였는데 안써도 됩니당
# @app.route("/get_img/<storekey>", methods=['GET']) #랜덤생성된 식당 키값으로 데이터 받아옴
Expand Down
25 changes: 22 additions & 3 deletions flask-server/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def __init__(self):

firebase = pyrebase.initialize_app(config)
self.db = firebase.database()
firebaseEmailAuth = firebase.auth()

#회원가입
def insert_user(self, data, pwd):
Expand Down Expand Up @@ -45,8 +46,20 @@ def find_user(self, ID_, pwd_):
if value['ID'] == ID_ and value['pwd'] == pwd_:
return True
return False


#평균 평점 계산하고 push해주는 함수
def AverageScore(self,storename):
count = 0
sum = 0
users=self.db.child("REVIEW").child(storename).get().val()
if users:
for user in users:
score=self.db.child("REVIEW").child(storename).child(user).get("storescore")
sum =sum +score
count =count+1
avg=sum/count
self.db.child("STORE").child(storename).push({"avg_score" ,avg})
# self.db.child("STORE").child(storename).ref('avg_score').push(avg)
return avg

#맛집 정보 입력 함수
def insert_store(self,name,data,img_path):
Expand All @@ -62,6 +75,7 @@ def insert_store(self,name,data,img_path):
"price2" : data['price2'],
"site" : data['site'],
"img_path" : img_path,
# "avg_score": "",
}
if self.store_duplicate_check(name):
self.db.child("STORE").push(store_info)
Expand Down Expand Up @@ -154,4 +168,9 @@ def get_menu(self,storename):

def get_review(self,storename):
reviews = self.db.child("REVIEW").child(storename).get().val() #해당 맛집의 메뉴들을 가져옴
return reviews
return reviews
def get_all_review(self):
stores=self.db.child("REVIEW").get().val()
for store in stores:
review_all=self.db.child("REVIEW").child(store).get().val()
return review_all
13 changes: 7 additions & 6 deletions flask-server/static/react/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"files": {
"main.css": "/static/react/css/main.f6bce912.css",
"main.js": "/static/react/js/main.7bc9bc8b.js",

"main.css": "/static/react/css/main.95ec6270.css",
"main.js": "/static/react/js/main.01efb3a2.js",
"js/787.ec704a7a.chunk.js": "/static/react/js/787.ec704a7a.chunk.js",
"media/symbol-mark.png": "/static/react/media/symbol-mark.8a35bde01c62d01eaa4b.png",
"media/sample.PNG": "/static/react/media/sample.5b41e09dc2adbb809249.PNG",
"media/logo.svg": "/static/react/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg",
"../../templates/index.html": "/static/react/../../templates/index.html",
"main.f6bce912.css.map": "/static/react/css/main.f6bce912.css.map",
"main.7bc9bc8b.js.map": "/static/react/js/main.7bc9bc8b.js.map",
"main.95ec6270.css.map": "/static/react/css/main.95ec6270.css.map",
"main.01efb3a2.js.map": "/static/react/js/main.01efb3a2.js.map",
"787.ec704a7a.chunk.js.map": "/static/react/js/787.ec704a7a.chunk.js.map"
},
"entrypoints": [
"css/main.f6bce912.css",
"js/main.7bc9bc8b.js"
"css/main.95ec6270.css",
"js/main.01efb3a2.js"
]
}
2 changes: 2 additions & 0 deletions flask-server/static/react/css/main.95ec6270.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions flask-server/static/react/css/main.95ec6270.css.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions flask-server/static/react/css/main.bb990da4.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions flask-server/static/react/js/main.01efb3a2.js

Large diffs are not rendered by default.

195 changes: 195 additions & 0 deletions flask-server/static/react/js/main.01efb3a2.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @license
* Copyright 2020 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @license React
* react-dom-test-utils.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* @remix-run/router v1.0.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/

/**
* React Router DOM v6.4.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/

/**
* React Router v6.4.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/

/** @license React v17.0.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
1 change: 1 addition & 0 deletions flask-server/static/react/js/main.01efb3a2.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions flask-server/static/react/js/main.6dcc4052.js

Large diffs are not rendered by default.

Loading