Skip to content

Commit

Permalink
fix admin
Browse files Browse the repository at this point in the history
  • Loading branch information
sasaujp committed Aug 19, 2021
1 parent a56cfac commit e0ad493
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions node/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = (env, args) => {
let FIREBASE_CONFIG
switch (args.mode) {
case 'development':
API_ENDPOINT = 'http://127.0.0.1:5000/api/v1'
API_ENDPOINT = 'http://localhost/api/v1'
FIREBASE_CONFIG = {
apiKey: "AIzaSyB3GMmRd9JWGVvDlEtgpemtYZPo-WRkNpc",
authDomain: "fabled-alchemy-246207.firebaseapp.com",
Expand All @@ -38,7 +38,7 @@ module.exports = (env, args) => {
}
break
default:
API_ENDPOINT = 'http://127.0.0.1:5000/api/v1'
API_ENDPOINT = 'http://localhost/api/v1'
FIREBASE_CONFIG = {
apiKey: "",
authDomain: "",
Expand Down
11 changes: 4 additions & 7 deletions server/dbcls/api/resources/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from dbcls import db
from dbcls.utils import localize_as_jst
from dbcls.models import DataSet
from dbcls.models import DataSet, User


parser = reqparse.RequestParser()
Expand All @@ -31,11 +31,9 @@ def _parse_args(self):

def get(self):
args = self._parse_args()

query = DataSet.query.order_by(DataSet.upload_at.desc())
query = DataSet.query.join(DataSet.user).with_entities(DataSet.id, DataSet.title, DataSet.path, DataSet.is_public, DataSet.upload_at, User.display_name, User.contact_uri).order_by(DataSet.upload_at.desc())
count = query.count()
query = query.offset(args['offset']).limit(SIZE_PER_PAGE)

# 前ページ
previousUrl = None
if args['offset'] >= 1:
Expand All @@ -49,7 +47,6 @@ def get(self):
params = {'page': args['page'] + 1}
params_string = urllib.parse.urlencode(params)
nextUrl = f'{request.path}?{params_string}'

return {
'count': count,
'previous': previousUrl,
Expand All @@ -64,8 +61,8 @@ def get(self):
localize_as_jst(data_set.upload_at).isoformat()
),
'user': {
'display_name': data_set.user.display_name,
'contact_uri': data_set.user.contact_uri,
'display_name': data_set.display_name,
'contact_uri': data_set.contact_uri,
}
}
for data_set in query
Expand Down

0 comments on commit e0ad493

Please sign in to comment.