diff --git a/app/Console/Commands/Invitation/All.php b/app/Console/Commands/Invitation/All.php deleted file mode 100644 index f9abe7b93..000000000 --- a/app/Console/Commands/Invitation/All.php +++ /dev/null @@ -1,25 +0,0 @@ -line($invitation->code); - } - - return 0; - } -} diff --git a/app/Console/Commands/Invitation/Create.php b/app/Console/Commands/Invitation/Create.php deleted file mode 100644 index cc09c2da6..000000000 --- a/app/Console/Commands/Invitation/Create.php +++ /dev/null @@ -1,30 +0,0 @@ -argument('code')); - $jobResult = (new InvitationCreateJob($code))->handle(); - - if ($jobResult) { - $this->line('Successfully created invitation: ' . $code); - } else { - $this->line('Failed to create invitation: ' . $code); - } - - return 0; - } -} diff --git a/app/Console/Commands/Invitation/CreateBulk.php b/app/Console/Commands/Invitation/CreateBulk.php deleted file mode 100644 index 0379c17a4..000000000 --- a/app/Console/Commands/Invitation/CreateBulk.php +++ /dev/null @@ -1,36 +0,0 @@ -argument('numCodes')); - $helper = new InviteHelper(); - - for ($i = 0; $i < $numCodes; $i++) { - $code = $helper->generate(); - $jobResult = (new InvitationCreateJob($code))->handle(); - - if ($jobResult) { - $this->line('Successfully created invitation: ' . $code); - } else { - $this->line('Failed to create invitation: ' . $code); - } - } - - return 0; - } -} diff --git a/app/Console/Commands/Invitation/Delete.php b/app/Console/Commands/Invitation/Delete.php deleted file mode 100644 index a115846dc..000000000 --- a/app/Console/Commands/Invitation/Delete.php +++ /dev/null @@ -1,24 +0,0 @@ -argument('code')); - (new InvitationDeleteJob($code))->handle(); - - return 0; - } -} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index cca1f77ab..b221cd888 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -71,8 +71,6 @@ protected function commands(): void { $this->load(__DIR__ . '/Commands/User'); $this->load(__DIR__ . '/Commands/Job'); $this->load(__DIR__ . '/Commands/Wiki'); - $this->load(__DIR__ . '/Commands/Invitation'); - require base_path('routes/console.php'); } } diff --git a/app/Invitation.php b/app/Invitation.php deleted file mode 100644 index 3e7c6f5a6..000000000 --- a/app/Invitation.php +++ /dev/null @@ -1,39 +0,0 @@ -code = strtolower($code); - } - - /** - * @return Invitation|null - */ - public function handle() { - $test = Invitation::where('code', $this->code)->first(); - if ($test) { - $this->fail( - new \RuntimeException('Invitation code already existed') - ); - - return; // safegaurd - } - - return Invitation::create([ - 'code' => $this->code, - ]); - } -} diff --git a/app/Jobs/InvitationDeleteJob.php b/app/Jobs/InvitationDeleteJob.php deleted file mode 100644 index 81619679f..000000000 --- a/app/Jobs/InvitationDeleteJob.php +++ /dev/null @@ -1,32 +0,0 @@ -code = strtolower($code); - } - - /** - * @return void - */ - public function handle() { - $invite = Invitation::where('code', $this->code)->first(); - if ($invite) { - $invite->delete(); - } else { - $this->fail( - new \RuntimeException('Invitation not found, so can\'t delete') - ); - - return; // safegaurd - } - } -} diff --git a/database/factories/InvitationFactory.php b/database/factories/InvitationFactory.php deleted file mode 100644 index 4928f0ebf..000000000 --- a/database/factories/InvitationFactory.php +++ /dev/null @@ -1,26 +0,0 @@ - $this->faker->unique()->text(20), - ]; - } -} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 625b49d94..4377e7c78 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -14,7 +14,6 @@ class DatabaseSeeder extends Seeder { public function run() { Model::unguard(); $this->call(UsersSeeder::class); - $this->call(InvitationsSeeder::class); $this->call(WikiDbsSeeder::class); $this->call(QueryserviceNamespacesSeeder::class); $this->call(WikisSeeder::class); diff --git a/database/seeds/InvitationsSeeder.php b/database/seeds/InvitationsSeeder.php deleted file mode 100644 index e80a37be2..000000000 --- a/database/seeds/InvitationsSeeder.php +++ /dev/null @@ -1,13 +0,0 @@ - 'invite1']); - Invitation::create(['code' => 'invite2']); - Invitation::create(['code' => 'invite3']); - Invitation::factory()->create(); - } -} diff --git a/docs/invitation-codes.md b/docs/invitation-codes.md deleted file mode 100644 index cec356073..000000000 --- a/docs/invitation-codes.md +++ /dev/null @@ -1,24 +0,0 @@ -In order to create an account, you will need to `exec` into an api container and create an invitation code with the `artisan` command. - -To create the invite code `invite1`, use the following command: -``` -php artisan wbs-invitation:create invite1 -``` -You should see the output `Successfully created invitation: invite1` - -You can view all invitation codes that have been created (and not used) with: -``` -php artisan wbs-invitation:all -``` - -And delete (unused) invitation codes with: - -``` -php artisan wbs-invitation:delete -``` - -Bulk create multiple random codes with: - -``` -php artisan wbs-invitation:create-bulk -``` diff --git a/tests/Routes/User/RegisterTest.php b/tests/Routes/User/RegisterTest.php index 34982dfdf..b7a6937f4 100644 --- a/tests/Routes/User/RegisterTest.php +++ b/tests/Routes/User/RegisterTest.php @@ -2,7 +2,6 @@ namespace Tests\Routes\User; -use App\Invitation; use App\Notifications\UserCreationNotification; use App\Rules\ReCaptchaValidation; use App\User; @@ -32,7 +31,6 @@ public function testCreateSuccess() { $this->mockReCaptchaValidation(); Notification::fake(); - $invite = Invitation::factory()->create(); $userToCreate = User::factory()->make(); $resp = $this->json('POST', $this->route, [ @@ -48,15 +46,11 @@ public function testCreateSuccess() { Notification::assertSentTo( [User::whereEmail($userToCreate->email)->first()], UserCreationNotification::class ); - - // SHIFT doesnt have missingFromDatabase - // ->missingFromDatabase('invitations', ['code' => $invite->code]); } public function testCreateEmailAlreadyTaken() { $this->mockReCaptchaValidation(); - $invite = Invitation::factory()->create(); $user = User::factory()->create(); $this->json('POST', $this->route, [ @@ -70,7 +64,6 @@ public function testCreateEmailAlreadyTaken() { public function testCreateNoToken() { $this->mockReCaptchaValidation(false); - $invite = Invitation::factory()->create(); $user = User::factory()->make(); $this->json('POST', $this->route, [ @@ -91,8 +84,6 @@ public function testCreateNoEmailOrPassword() { public function testCreateBadEmail() { $this->mockReCaptchaValidation(); - $invite = Invitation::factory()->create(); - $this->json('POST', $this->route, [ 'email' => 'notAnEmail', 'password' => 'anyPassword',