update sql files from christine to remove warnings by running skeema

This commit is contained in:
team-devstage 2020-07-28 18:04:59 +02:00
commit 10c92fd464
5 changed files with 29 additions and 9 deletions

View File

@ -0,0 +1,8 @@
CREATE TABLE `community_profiles` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`state_user_id` INT UNSIGNED NOT NULL,
`profile_img` LONGBLOB NULL,
`profile_desc` VARCHAR(2000) NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`state_user_id`) REFERENCES `state_users`(`id`)
) ENGINE=InnoDB;

View File

@ -7,6 +7,7 @@ CREATE TABLE `state_users` (
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`disabled` tinyint DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `public_key` (`public_key`)
) ENGINE=InnoDB;

View File

@ -199,12 +199,15 @@ class AppController extends Controller
if ($stateUserQuery->count() == 1) {
$stateUser = $stateUserQuery->first();
if ($stateUser->first_name != $json['user']['first_name'] ||
$stateUser->last_name != $json['user']['last_name'] ||
//$stateUser->username != $json['user']['username'] ||
// -> throws error
$stateUser->email != $json['user']['email']) {
$stateUser->last_name != $json['user']['last_name'] ||
$stateUser->disabled != $json['user']['disabled'] ||
//$stateUser->username != $json['user']['username'] ||
// -> throws error
$stateUser->email != $json['user']['email']
) {
$stateUser->first_name = $json['user']['first_name'];
$stateUser->last_name = $json['user']['last_name'];
$stateUser->disabled = $json['user']['disabled'];
//$stateUser->username = $json['user']['username'];
$stateUser->email = $json['user']['email'];
if (!$stateUserTable->save($stateUser)) {
@ -222,6 +225,7 @@ class AppController extends Controller
$newStateUser->public_key = $public_key_bin;
$newStateUser->first_name = $json['user']['first_name'];
$newStateUser->last_name = $json['user']['last_name'];
$newStateUser->disabled = $json['user']['disabled'];
//$newStateUser->username = $json['user']['username'];
$newStateUser->email = $json['user']['email'];
if (!$stateUserTable->save($newStateUser)) {

View File

@ -242,11 +242,17 @@ class TransactionCreationsController extends AppController
->find('all')
->select(['id', 'first_name', 'last_name', 'email'])
->order(['first_name', 'last_name'])
->where(['OR' => [
'LOWER(first_name)' => strtolower($requestData['searchText']),
'LOWER(last_name)' => strtolower($requestData['searchText']),
'LOWER(email)' => strtolower($requestData['searchText'])
]])
->where(
['AND' => [
'disabled' => 0,
'OR' => [
'LOWER(first_name)' => strtolower($requestData['searchText']),
'LOWER(last_name)' => strtolower($requestData['searchText']),
'LOWER(email)' => strtolower($requestData['searchText'])
]
]
]
)
->contain(['TransactionCreations' => [
'fields' => [
'TransactionCreations.amount',

View File

@ -36,6 +36,7 @@ class StateUser extends Entity
'email' => true,
'first_name' => true,
'last_name' => true,
'disabled' => true,
'username' => true,
'index' => true,
'state_group' => true,