major claude changes

This commit is contained in:
2026-01-28 21:55:10 -05:00
parent 3f311980db
commit 2dbd3ea53f
41 changed files with 1235 additions and 278 deletions

View File

@@ -1,14 +1,20 @@
import logging
from flask import jsonify, request
import datetime
from app.social import social
from app import db
from app.classes.customer_social import (Customer_Customer_Social_schema,
from app.classes.customer_social import (Customer_Customer_Social_schema,
Customer_Customer_Social)
from flask_login import login_required
logger = logging.getLogger(__name__)
@social.route("/posts/<int:customer_id>/<int:page>", methods=["GET"])
@login_required
def get_customer_posts(customer_id, page):
logger.info(f"GET /social/posts/{customer_id}/{page} - Fetching customer posts page {page}")
per_page_amount = 50
if page is None:
offset_limit = 0
@@ -16,7 +22,7 @@ def get_customer_posts(customer_id, page):
offset_limit = 0
else:
offset_limit = (per_page_amount * page) - per_page_amount
customer_posts = (db.session
.query(Customer_Customer_Social)
.filter(Customer_Customer_Social.customer_id == customer_id)
@@ -28,8 +34,10 @@ def get_customer_posts(customer_id, page):
@social.route("/create/<int:customer_id>", methods=["POST"])
@login_required
def create_post(customer_id):
logger.info(f"POST /social/create/{customer_id} - Creating new social post")
comment = request.json["comment"]
poster_employee_id = request.json["poster_employee_id"]
@@ -47,7 +55,9 @@ def create_post(customer_id):
@social.route("/posts/<int:post_id>", methods=["PATCH"])
@login_required
def edit_post(post_id):
logger.info(f"PATCH /social/posts/{post_id} - Editing social post")
customer_post = (db.session
.query(Customer_Customer_Social)
@@ -55,7 +65,7 @@ def edit_post(post_id):
.first())
comment = request.json["comment"]
customer_post.comment = comment
db.session.add(customer_post)
db.session.commit()
@@ -64,7 +74,9 @@ def edit_post(post_id):
@social.route("/delete/<int:post_id>", methods=["DELETE"])
@login_required
def delete_post(post_id):
logger.info(f"DELETE /social/delete/{post_id} - Deleting social post")
customer_post = (db.session
.query(Customer_Customer_Social)