def getAccountInfo(): response = {} params = request.args try: UUID=params["UUID"] accountDM.getAccountInfoDB(UUID) result = accountDM.getAccountInfoDB(UUID) response = result except: response=False return make_response(jsonify(response))
def postMusicData(): params = request.args try: UUID = params["UUID"] try: accountinfo = accountDM.getAccountInfoDB(UUID)[0] accountID = accountinfo["accountID"] contributor = accountinfo["accountName"] except: return "does not exist UUID" musicTitle = params["musicTitle"] poet = params["poet"] composer = params["composer"] postDate = params["postDate"] poetryData_Path = params["poetryData_Path"] compositionData_Path = params["compositionData_Path"] result = musicDM.postMusicDataDB(musicTitle, poet, composer, contributor, postDate, poetryData_Path, compositionData_Path) try: # resultからmusicIDを取得 id = result[0]["musicID"] except: return result + "\n Failed to post to mycollection_tb" result = myCollectionDM.postMycollectionDataDB(accountID, id) except: result = False return make_response(jsonify(result))
def getMycollection(): myCollectionList = [] params = request.args try: UUID = params["UUID"] try: accountID = accountDM.getAccountInfoDB(UUID)[0]["accountID"] except: return make_response(jsonify(myCollectionList)) myCollectionList = myCollectionDM.getMyCollectionDB(accountID) except: pass return make_response(jsonify(myCollectionList))
def postMycollectionData(): params = request.args try: UUID = params["UUID"] mycollectionID = params["mycollectionID"] # mycollectionIDのデータチェック if not MyCollectionID.pattern_check(mycollectionID): return "Invalid mycollectionID" try: accountID = accountDM.getAccountInfoDB(UUID)[0]["accountID"] except: return "does not exist UUID" result = myCollectionDM.postMycollectionDataDB(accountID, mycollectionID) except: result = False return make_response(jsonify(result))
def deleteMyCollection(): result = False params = request.args try: UUID = params["UUID"] mycollectionID = params["mycollectionID"] # mycollectionIDのデータチェック if not MyCollectionID.pattern_check(mycollectionID): return "Invalid mycollectionID" try: accountID = accountDM.getAccountInfoDB(UUID)[0]["accountID"] except: return make_response(jsonify(result)) result = myCollectionDM.deleteMyCollectionDB(accountID, mycollectionID) except: pass return make_response(jsonify(result))
def postPoetryData(): params = request.args try: UUID = params["UUID"] try: accountinfo = accountDM.getAccountInfoDB(UUID)[0] accountID = accountinfo["accountID"] poet = accountinfo["accountName"] except: return "does not exist UUID" poetryTitle = params["poetryTitle"] postDate = params["postDate"] poetryData_Path = params["poetryData_Path"] result = poetryDM.postPoetryDataDB(poetryTitle, poet, postDate, poetryData_Path) try: id = result[0]["poetryID"] except: return result + "\n Failed to post to mycollection_tb" result = myCollectionDM.postMycollectionDataDB(accountID, id) except: result = False return make_response(jsonify(result))