EmailCRUD
Some checks failed
K8S Fission Deployment / Deployment fission functions (push) Failing after 21s
Some checks failed
K8S Fission Deployment / Deployment fission functions (push) Failing after 21s
This commit is contained in:
@@ -89,6 +89,7 @@ def main():
|
||||
|
||||
|
||||
def user_insert_email():
|
||||
# 1. Lấy user_id từ header (identity.id Kratos)
|
||||
user_id = request.headers.get("X-UserId")
|
||||
if not user_id:
|
||||
return jsonify({"errorCode": "USER_ID_REQUIRED"}), 400, CORS_HEADERS
|
||||
@@ -97,7 +98,7 @@ def user_insert_email():
|
||||
if not data:
|
||||
return jsonify({"errorCode": "NO_DATA_PROVIDED"}), 400, CORS_HEADERS
|
||||
|
||||
parsed = UserEmailRequest(**data) # parsed luu du lieu gi ?
|
||||
parsed = UserEmailRequest(**data) # parsed(object) luu du lieu validate body ma data gui len la 1 dict
|
||||
except ValidationError as e:
|
||||
return jsonify({"errorCode": "VALIDATION_ERROR", "details": e.errors()}), 422, CORS_HEADERS
|
||||
except Exception as e:
|
||||
@@ -106,7 +107,7 @@ def user_insert_email():
|
||||
try:
|
||||
add_email, status_code, headers = crud.add_email_to_user(
|
||||
user_id, parsed.email)
|
||||
if parsed.is_primary:
|
||||
if parsed.is_primary: # Neu parsed la nick email chinh
|
||||
# update email kratos
|
||||
identity = kratos.get_identity(user_id)
|
||||
traits = identity.traits
|
||||
@@ -135,7 +136,7 @@ def user_filter_emails():
|
||||
try:
|
||||
conn = init_db_connection()
|
||||
with conn.cursor() as cursor:
|
||||
records = __filter_email(cursor, paging, user_id) # Xu ly gi day ?
|
||||
records = __filter_email(cursor, paging, user_id) # Xu ly gi day ? goi ham _filter_email
|
||||
|
||||
return jsonify(
|
||||
records,
|
||||
|
||||
Reference in New Issue
Block a user