Skip to content

Commit

Permalink
Merge pull request #228 from ledgerleapllc/development
Browse files Browse the repository at this point in the history
Sync development to staging
  • Loading branch information
ledgerleapllc authored Dec 20, 2022
2 parents 50851aa + 6911e07 commit c6b0e69
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
25 changes: 24 additions & 1 deletion app/Http/Controllers/Api/V1/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ public function getUsers(Request $request)

$query = "
SELECT
a.id, a.first_name, a.last_name, a.email,
a.id, a.cmp_check, a.first_name, a.last_name, a.email,
a.pseudonym, a.telegram, a.email_verified_at,
a.entity_name, a.last_login_at, a.created_at,
a.signature_request_id, a.node_status, a.node_verified_at,
Expand Down Expand Up @@ -675,6 +675,9 @@ public function getUsers(Request $request)
case 'created_at':
$sort_key = 'a.created_at';
break;
case 'cmp_check':
$sort_key = 'a.cmp_check';
break;
default:
$sort_key = 'a.id';
break;
Expand Down Expand Up @@ -2212,4 +2215,24 @@ public function uploadMembershipFile(Request $request)
);
}
}

public function updateCMPStatus(Request $request) {
$params = $request->all();
$userId = (int) data_get($params, 'userId', 0);
$value = (int) data_get($params, 'value', 0);

if (!$userId) {
return $this->errorResponse('Invalid user', Response::HTTP_BAD_REQUEST);
}

$user = User::find($userId);
if (!$user) {
return $this->errorResponse('Invalid user', Response::HTTP_BAD_REQUEST);
}

$user->cmp_check = $value;
$user->save();

return $this->metaSuccess();
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/V1/DiscussionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getTrending(Request $request)
{
$user = auth()->user()->load(['pagePermissions']);
if (Helper::isAccessBlocked($user, 'discussions'))
return $this->successResponse(['data' => []]);
return $this->successResponse([]);

$trendings = Discussion::where('likes', '!=', 0)
->where('is_draft', 0)
Expand Down
30 changes: 30 additions & 0 deletions database/migrations/2022_12_20_084135_update_users_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class UpdateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('cmp_check')->default(false)->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
3 changes: 3 additions & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@
Route::delete('/contact-recipients/{id}', [ContactController::class, 'deleteContactRecipients'])->where('id', '[0-9]+');
Route::post('/membership-file', [AdminController::class, 'uploadMembershipFile']);

// CMP Status
Route::post('/cmp-status', [AdminController::class, 'updateCMPStatus']);

// Block Access
Route::post('/block-access', [BlockAccessController::class, 'updateBlockAccess']);
});
Expand Down

0 comments on commit c6b0e69

Please sign in to comment.