Skip to content
Draft
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
7 changes: 6 additions & 1 deletion app/Http/Controllers/API/v1/WalletController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@ public function store(Request $request): JsonResponse
}
$wallet->markAsSynced();
} catch (\Exception $e) {
return $this->failure('Wallet already exists', 400);
logger()->error('Failed to create wallet', [
'user_id' => $user->id,
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString(),
]);
return $this->failure('Failed to create wallet', 400, [$e->getMessage()]);
}

return $this->success($wallet, 'Wallet created successfully', 201);
Expand Down
1 change: 1 addition & 0 deletions app/Traits/Syncable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public static function bootSyncable(): void
static::created(function ($model) {
$model->syncState()->create([
'last_synced_at' => now(),
'user_id' => auth()->id(),
]);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public function up(): void
$table->string('source')->nullable();
$table->uuid('client_generated_id')->index()->nullable();
$table->timestamp('last_synced_at');
$table->unsignedBigInteger('user_id');
$table->unique(['syncable_type', 'client_generated_id', 'user_id'], 'syncable_user_unique');
$table->timestamps();
});
}
Expand Down
1 change: 1 addition & 0 deletions database/seeders/TransactionSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public function run(): void
{
foreach (range(1, 10) as $index) {
$user = User::find($index);
auth()->login($user);
if (! $user) {
continue;
}
Expand Down
2 changes: 2 additions & 0 deletions database/seeders/UserSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public function run(): void
'username' => "user{$index}",
]);

auth()->login($user);

Party::factory(5)->create([
'user_id' => $user->id,
]);
Expand Down
Loading