Skip to content

Commit

Permalink
add unfinished_invitation
Browse files Browse the repository at this point in the history
  • Loading branch information
Moujuruo committed Jun 7, 2024
1 parent 0b1889f commit 5d29ea2
Show file tree
Hide file tree
Showing 7 changed files with 26,357 additions and 21,077 deletions.
Binary file modified Ai_work.db
Binary file not shown.
17 changes: 17 additions & 0 deletions backend/run_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,23 @@ def inviteMember():
return jsonify({"data": "Failed to invite member", "status": 500}), 500
return jsonify({"data": "Member invited successfully", "status": 200}), 200

# getBeInvitedTeams
@app.route(apiPrefix + 'getBeInvitedTeams', methods=['POST'])
def getBeInvitedTeams():
data = request.get_json()
userID = data['userID']
result = Team.search_in_team_invitation(userID)
if result is False:
return jsonify({"data": "Failed to get team list", "status": 500}), 500
key = ['team_id', 'user_id', 'captain_id']
# captain_id 要通过result中的team_id去查询get_team_captatin
# result每个元组的第一个元素是team_id
for i in range(len(result)):
result[i] = [result[i][0], result[i][1], Team.get_team_captain(result[i][0])[0]]
result = list(map(lambda x: dict(zip(key, x)), result))
return jsonify({"data": result, "status": 200}), 200

# return jsonify({"data": result, "status": 200}), 200


################## Note接口 ##################
Expand Down
11 changes: 11 additions & 0 deletions backend/sqlite_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ def get_team_info(team_id):
return False
finally:
lock_threading.release()

def get_team_captain(team_id):
try:
lock_threading.acquire()
cursor.execute('''SELECT captain_id FROM team WHERE id = ? ''', (team_id,))
return cursor.fetchone()
except sqlite3.Error as e:
print(e)
return False
finally:
lock_threading.release()

def get_user_teams_with_captain_flag(user_id):
try:
Expand Down
Loading

0 comments on commit 5d29ea2

Please sign in to comment.