Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/Http/Controllers/Api/V1/TaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function store(Request $request)
'dealership_id' => 'nullable|exists:auto_dealerships,id',
'appear_date' => 'nullable|string|after_or_equal:now', // Bug #4: не раньше текущего времени
'deadline' => 'nullable|string',
'recurrence' => 'nullable|string|in:daily,weekly,monthly',
'recurrence' => 'nullable|string|in:none,daily,weekly,monthly',
'recurrence_time' => 'nullable|date_format:H:i', // Время для повторяющихся задач
'recurrence_day_of_week' => 'nullable|integer|min:1|max:7', // 1=Пн, 7=Вс
'recurrence_day_of_month' => 'nullable|integer|min:-2|max:31', // -1=первое, -2=последнее, 1-31=число
Expand All @@ -220,7 +220,7 @@ public function store(Request $request)
]);

// Custom validation for recurring tasks
if (!empty($validated['recurrence'])) {
if (!empty($validated['recurrence']) && $validated['recurrence'] !== 'none') {
switch ($validated['recurrence']) {
case 'daily':
// Daily tasks require recurrence_time
Expand Down Expand Up @@ -296,7 +296,7 @@ public function update(Request $request, $id)
'dealership_id' => 'nullable|exists:auto_dealerships,id',
'appear_date' => 'nullable|string',
'deadline' => 'nullable|string',
'recurrence' => 'nullable|string|in:daily,weekly,monthly',
'recurrence' => 'nullable|string|in:none,daily,weekly,monthly',
'recurrence_time' => 'nullable|date_format:H:i',
'recurrence_day_of_week' => 'nullable|integer|min:1|max:7',
'recurrence_day_of_month' => 'nullable|integer|min:-2|max:31',
Expand All @@ -310,7 +310,7 @@ public function update(Request $request, $id)

// Custom validation for recurring tasks
$recurrence = $validated['recurrence'] ?? $task->recurrence;
if (!empty($recurrence)) {
if (!empty($recurrence) && $recurrence !== 'none') {
$recurrenceTime = $validated['recurrence_time'] ?? $task->recurrence_time;
$recurrenceDayOfWeek = $validated['recurrence_day_of_week'] ?? $task->recurrence_day_of_week;
$recurrenceDayOfMonth = $validated['recurrence_day_of_month'] ?? $task->recurrence_day_of_month;
Expand Down
6 changes: 3 additions & 3 deletions swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ components:
example: 2025-10-15T18:00:00Z
recurrence:
type: string
enum: [daily, weekly, monthly]
enum: [none, daily, weekly, monthly]
nullable: true
example: weekly
recurrence_time:
Expand Down Expand Up @@ -2386,7 +2386,7 @@ paths:
example: "2025-10-15T18:00:00Z"
recurrence:
type: string
enum: [daily, weekly, monthly]
enum: [none, daily, weekly, monthly]
nullable: true
example: weekly
recurrence_time:
Expand Down Expand Up @@ -2537,7 +2537,7 @@ paths:
example: "2025-10-16T18:00:00Z"
recurrence:
type: string
enum: [daily, weekly, monthly]
enum: [none, daily, weekly, monthly]
nullable: true
example: daily
recurrence_time:
Expand Down