add todos and improve db schema

This commit is contained in:
Dennis Eichhorn 2020-01-01 21:05:12 +01:00
parent 985006e18e
commit 3294f7e3f4
3 changed files with 59 additions and 209 deletions

View File

@ -38,39 +38,6 @@
} }
} }
}, },
"profile_account_permission": {
"name": "profile_account_permission",
"fields": {
"profile_account_permission_id": {
"name": "profile_account_permission_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"profile_account_permission_profile": {
"name": "profile_account_permission_profile",
"type": "INT",
"null": false,
"foreignTable": "profile_account",
"foreignKey": "profile_account_id"
},
"profile_account_permission_group": {
"name": "profile_account_permission_group",
"type": "INT",
"null": false,
"foreignTable": "group",
"foreignKey": "group_id"
},
"profile_account_permission_account": {
"name": "profile_account_permission_account",
"type": "INT",
"null": false,
"foreignTable": "account",
"foreignKey": "account_id"
}
}
},
"profile_contact": { "profile_contact": {
"name": "profile_contact", "name": "profile_contact",
"fields": { "fields": {
@ -148,8 +115,19 @@
"type": "TEXT", "type": "TEXT",
"null": false "null": false
}, },
"profile_contact_account": { "profile_contact_image": {
"name": "profile_contact_account", "name": "profile_contact_image",
"type": "INT",
"default": null,
"null": true,
"foreignTable": "media",
"foreignKey": "media_id",
"annotations": {
"gdpr": true
}
},
"profile_contact_profile": {
"name": "profile_contact_profile",
"type": "INT", "type": "INT",
"null": false, "null": false,
"foreignTable": "profile_account", "foreignTable": "profile_account",
@ -192,9 +170,40 @@
} }
} }
}, },
"profile_contact_address": {
"name": "profile_contact_address",
"fields": {
"profile_contact_address_id": {
"name": "profile_contact_address_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"profile_contact_address_type": {
"name": "profile_contact_address_type",
"type": "TINYINT",
"null": false
},
"profile_contact_address_contact": {
"name": "profile_contact_address_contact",
"type": "INT",
"null": false,
"foreignTable": "profile_contact",
"foreignKey": "profile_contact_id"
},
"profile_contact_address_address": {
"name": "profile_contact_address_address",
"type": "INT",
"null": false,
"foreignTable": "address",
"foreignKey": "address_id"
}
}
},
"profile_contactelement": { "profile_contactelement": {
"name": "profile_contactelement", "name": "profile_contactelement",
"comment": "not a full contact only the element like email, phone etc. for the accounts themselves (not profile_account)", "comment": "email, phone etc for profiles",
"fields": { "fields": {
"profile_contactelement_id": { "profile_contactelement_id": {
"name": "profile_contactelement_id", "name": "profile_contactelement_id",
@ -218,12 +227,12 @@
"type": "VARCHAR(255)", "type": "VARCHAR(255)",
"null": false "null": false
}, },
"profile_contactelement_account": { "profile_contactelement_contact": {
"name": "profile_contactelement_account", "name": "profile_contactelement_contact",
"type": "INT", "type": "INT",
"null": false, "null": false,
"foreignTable": "account", "foreignTable": "profile_account",
"foreignKey": "account_id" "foreignKey": "profile_account_id"
} }
} }
}, },
@ -242,119 +251,19 @@
"type": "TINYINT", "type": "TINYINT",
"null": false "null": false
}, },
"profile_address_address": { "profile_address_profile": {
"name": "profile_address_address", "name": "profile_address_profile",
"type": "VARCHAR(255)",
"null": false,
"annotations": {
"gdpr": true
}
},
"profile_address_street": {
"name": "profile_address_street",
"type": "VARCHAR(255)",
"null": false,
"annotations": {
"gdpr": true
}
},
"profile_address_city": {
"name": "profile_address_city",
"type": "VARCHAR(255)",
"null": false,
"annotations": {
"gdpr": true
}
},
"profile_address_zip": {
"name": "profile_address_zip",
"type": "VARCHAR(255)",
"null": false,
"annotations": {
"gdpr": true
}
},
"profile_address_country": {
"name": "profile_address_country",
"type": "VARCHAR(255)",
"null": false,
"annotations": {
"gdpr": true
}
},
"profile_address_account": {
"name": "profile_address_account",
"type": "INT", "type": "INT",
"null": false, "null": false,
"foreignTable": "profile_account", "foreignTable": "profile_account",
"foreignKey": "profile_account_id" "foreignKey": "profile_account_id"
} },
} "profile_address_address": {
}, "name": "profile_address_address",
"profile_account_relation": {
"name": "profile_account_relation",
"fields": {
"profile_account_relation_id": {
"name": "profile_account_relation_id",
"type": "INT", "type": "INT",
"null": false, "null": false,
"primary": true, "foreignTable": "address",
"autoincrement": true "foreignKey": "address_id"
},
"profile_account_relation_type": {
"name": "profile_account_relation_type",
"type": "TINYINT",
"null": false
},
"profile_account_relation_relation": {
"name": "profile_account_relation_relation",
"type": "INT",
"default": null,
"null": true
},
"profile_account_relation_account": {
"name": "profile_account_relation_account",
"type": "INT",
"default": null,
"null": true,
"foreignTable": "account",
"foreignKey": "account_id"
}
}
},
"profile_account_setting": {
"name": "profile_account_setting",
"fields": {
"profile_account_setting_id": {
"name": "profile_account_setting_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"profile_account_setting_module": {
"name": "profile_account_setting_module",
"type": "INT",
"null": false
},
"profile_account_setting_type": {
"name": "profile_account_setting_type",
"type": "VARCHAR(20)",
"null": false
},
"profile_account_setting_value": {
"name": "profile_account_setting_value",
"type": "VARCHAR(32)",
"default": null,
"null": true
},
"profile_account_setting_account": {
"name": "profile_account_setting_account",
"type": "INT",
"default": null,
"null": true,
"foreignTable": "account",
"foreignKey": "account_id"
} }
} }
} }

View File

@ -1,60 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\Profile\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\Profile\Models;
use phpOMS\DataStorage\Database\DataMapperAbstract;
/**
* Address mapper.
*
* @package Modules\Profile\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
final class AddressMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array<string, array<string, bool|string>>
* @since 1.0.0
*/
protected static array $columns = [
'profile_address_id' => ['name' => 'profile_address_id', 'type' => 'int', 'internal' => 'id'],
'profile_address_type' => ['name' => 'profile_address_type', 'type' => 'int', 'internal' => 'type'],
'profile_address_address' => ['name' => 'profile_address_address', 'type' => 'string', 'internal' => 'address'],
'profile_address_street' => ['name' => 'profile_address_street', 'type' => 'string', 'internal' => 'street'],
'profile_address_city' => ['name' => 'profile_address_city', 'type' => 'string', 'internal' => 'city'],
'profile_address_zip' => ['name' => 'profile_address_zip', 'type' => 'string', 'internal' => 'postal'],
'profile_address_country' => ['name' => 'profile_address_country', 'type' => 'string', 'internal' => 'country'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static string $table = 'profile_address';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static string $primaryField = 'profile_address_id';
}

View File

@ -17,6 +17,7 @@ namespace Modules\Profile\Models;
use Modules\Admin\Models\AccountMapper; use Modules\Admin\Models\AccountMapper;
use Modules\Media\Models\MediaMapper; use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
use Modules\Address\Models\AddressMapper;
/** /**
* Profile mapper. * Profile mapper.
@ -68,8 +69,8 @@ final class ProfileMapper extends DataMapperAbstract
'location' => [ 'location' => [
'mapper' => AddressMapper::class, 'mapper' => AddressMapper::class,
'table' => 'profile_address', 'table' => 'profile_address',
'dst' => 'profile_address_account', 'dst' => 'profile_address_address',
'src' => null, 'src' => 'profile_address_profile',
], ],
]; ];