feat(spaces): stamp bank-synced rows and hide internal space_id
Set space_id explicitly on bank-sync transaction inserts (avoids a per-row lookup during sync and anchors the row to the account's space), and hide the internal space_id foreign key from model serialization.
This commit is contained in:
parent
c541dfc104
commit
6b9a1d1b74
|
|
@ -34,6 +34,11 @@ class AutomationRule extends Model
|
|||
'action_note_iv',
|
||||
];
|
||||
|
||||
/** @var list<string> */
|
||||
protected $hidden = [
|
||||
'space_id',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class BankingConnection extends Model
|
|||
];
|
||||
|
||||
protected $hidden = [
|
||||
'space_id',
|
||||
'api_token',
|
||||
'api_secret',
|
||||
'pending_accounts_data',
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class Budget extends Model
|
|||
/** @var list<string> */
|
||||
protected $hidden = [
|
||||
'period_duration',
|
||||
'space_id',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class Label extends Model
|
|||
*/
|
||||
protected $hidden = [
|
||||
'pivot',
|
||||
'space_id',
|
||||
];
|
||||
|
||||
/** @return BelongsTo<User, $this> */
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ class TransactionSyncService
|
|||
try {
|
||||
$account->transactions()->create([
|
||||
'user_id' => $account->user_id,
|
||||
'space_id' => $account->space_id,
|
||||
'description' => $formatted['description'],
|
||||
'description_iv' => null,
|
||||
'original_description' => $formatted['original_description'],
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ class WiseTransactionSyncService
|
|||
try {
|
||||
$account->transactions()->create([
|
||||
'user_id' => $account->user_id,
|
||||
'space_id' => $account->space_id,
|
||||
'description' => $parsed['description'],
|
||||
'description_iv' => null,
|
||||
'original_description' => $parsed['description'],
|
||||
|
|
|
|||
Loading…
Reference in New Issue