backend/api/schedules.py
CHANGED
|
@@ -101,6 +101,9 @@ def create_schedule():
|
|
| 101 |
# Get timezone information (optional, will use server timezone if not provided)
|
| 102 |
user_timezone = data.get('timezone', get_server_timezone())
|
| 103 |
|
|
|
|
|
|
|
|
|
|
| 104 |
# Validate timezone if provided
|
| 105 |
if user_timezone and not validate_timezone(user_timezone):
|
| 106 |
# Add CORS headers to error response
|
|
|
|
| 101 |
# Get timezone information (optional, will use server timezone if not provided)
|
| 102 |
user_timezone = data.get('timezone', get_server_timezone())
|
| 103 |
|
| 104 |
+
print(f"[DEBUG] Received timezone: {user_timezone}")
|
| 105 |
+
print(f"[DEBUG] All request data: {data}")
|
| 106 |
+
|
| 107 |
# Validate timezone if provided
|
| 108 |
if user_timezone and not validate_timezone(user_timezone):
|
| 109 |
# Add CORS headers to error response
|
backend/services/schedule_service.py
CHANGED
|
@@ -110,9 +110,13 @@ class ScheduleService:
|
|
| 110 |
# Add timezone if provided
|
| 111 |
if timezone:
|
| 112 |
formatted_schedule = format_timezone_schedule(formatted_schedule, timezone)
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
# Calculate adjusted time (5 minutes before for content generation)
|
| 115 |
adjusted_time = calculate_adjusted_time_with_timezone(formatted_schedule, timezone)
|
|
|
|
| 116 |
|
| 117 |
# Insert schedule
|
| 118 |
response = (
|
|
@@ -126,6 +130,8 @@ class ScheduleService:
|
|
| 126 |
.execute()
|
| 127 |
)
|
| 128 |
|
|
|
|
|
|
|
| 129 |
if response.data:
|
| 130 |
schedule = Schedule.from_dict({
|
| 131 |
'id': response.data[0]['id'],
|
|
|
|
| 110 |
# Add timezone if provided
|
| 111 |
if timezone:
|
| 112 |
formatted_schedule = format_timezone_schedule(formatted_schedule, timezone)
|
| 113 |
+
print(f"[DEBUG] Formatted schedule with timezone: {formatted_schedule}")
|
| 114 |
+
else:
|
| 115 |
+
print(f"[DEBUG] No timezone provided for schedule: {formatted_schedule}")
|
| 116 |
|
| 117 |
# Calculate adjusted time (5 minutes before for content generation)
|
| 118 |
adjusted_time = calculate_adjusted_time_with_timezone(formatted_schedule, timezone)
|
| 119 |
+
print(f"[DEBUG] Adjusted time: {adjusted_time}")
|
| 120 |
|
| 121 |
# Insert schedule
|
| 122 |
response = (
|
|
|
|
| 130 |
.execute()
|
| 131 |
)
|
| 132 |
|
| 133 |
+
print(f"[DEBUG] Database response: {response.data}")
|
| 134 |
+
|
| 135 |
if response.data:
|
| 136 |
schedule = Schedule.from_dict({
|
| 137 |
'id': response.data[0]['id'],
|
frontend/src/pages/Schedule.jsx
CHANGED
|
@@ -67,6 +67,13 @@ const Schedule = () => {
|
|
| 67 |
throw new Error(errorMessage);
|
| 68 |
}
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
await dispatch(createSchedule({
|
| 71 |
social_network: selectedAccount, // Pass the account ID, not the social network name
|
| 72 |
schedule_time: scheduleTime,
|
|
|
|
| 67 |
throw new Error(errorMessage);
|
| 68 |
}
|
| 69 |
|
| 70 |
+
console.log('[DEBUG] Creating schedule with:', {
|
| 71 |
+
social_network: selectedAccount,
|
| 72 |
+
schedule_time: scheduleTime,
|
| 73 |
+
days: selectedDays,
|
| 74 |
+
timezone: userTimezone
|
| 75 |
+
});
|
| 76 |
+
|
| 77 |
await dispatch(createSchedule({
|
| 78 |
social_network: selectedAccount, // Pass the account ID, not the social network name
|
| 79 |
schedule_time: scheduleTime,
|
frontend/src/services/scheduleService.js
CHANGED
|
@@ -36,6 +36,9 @@ class ScheduleService {
|
|
| 36 |
// Get user timezone if not provided
|
| 37 |
const timezone = scheduleData.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
const response = await apiClient.post('/schedules', {
|
| 40 |
social_network: scheduleData.social_network,
|
| 41 |
schedule_time: scheduleData.schedule_time,
|
|
|
|
| 36 |
// Get user timezone if not provided
|
| 37 |
const timezone = scheduleData.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
| 38 |
|
| 39 |
+
console.log('[DEBUG] ScheduleService.create - timezone:', timezone);
|
| 40 |
+
console.log('[DEBUG] ScheduleService.create - scheduleData:', scheduleData);
|
| 41 |
+
|
| 42 |
const response = await apiClient.post('/schedules', {
|
| 43 |
social_network: scheduleData.social_network,
|
| 44 |
schedule_time: scheduleData.schedule_time,
|