mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:24:03 +00:00
improve comments, move method to SyncMaster interface
This commit is contained in:
parent
818026eaaa
commit
5ddd50deb9
3 changed files with 5 additions and 16 deletions
|
|
@ -15,4 +15,6 @@ interface SyncMaster extends Syncable
|
|||
public function tenants(): BelongsToMany;
|
||||
|
||||
public function getTenantModelName(): string;
|
||||
|
||||
public function getCreateAttributeNames(): array;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,4 @@ interface Syncable
|
|||
public function getSyncedAttributeNames(): array;
|
||||
|
||||
public function triggerSyncEvent();
|
||||
|
||||
public function getCreateAttributeNames(): array;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,8 +150,9 @@ test('creating the resource in tenant database creates it in central database an
|
|||
|
||||
tenancy()->end();
|
||||
|
||||
// assert user was created
|
||||
// Assert central user was created without `code` property
|
||||
expect(CentralUser::first()->global_id)->toBe('acme');
|
||||
expect(CentralUser::first()->code)->toBeNull();
|
||||
});
|
||||
|
||||
test('creating the resource in tenant database creates it in central database and creates the mapping', function () {
|
||||
|
|
@ -629,7 +630,7 @@ class CentralUser extends Model implements SyncMaster
|
|||
|
||||
public function getCreateAttributeNames(): array
|
||||
{
|
||||
// attributes should be used when syncing resources from central to tenant DB
|
||||
// Attributes used when creating resources from central to tenant DB
|
||||
return [
|
||||
'global_id',
|
||||
'name',
|
||||
|
|
@ -673,16 +674,4 @@ class ResourceUser extends Model implements Syncable
|
|||
'email',
|
||||
];
|
||||
}
|
||||
|
||||
public function getCreateAttributeNames(): array
|
||||
{
|
||||
// attributes should be used when syncing resources from tenant to central DB
|
||||
return [
|
||||
'global_id',
|
||||
'name',
|
||||
'password',
|
||||
'email',
|
||||
'role'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue