WIP: Road to 1.0.0 #1

Draft
miguel456 wants to merge 123 commits from develop into master
10 changed files with 214 additions and 68 deletions
Showing only changes of commit e4fb438721 - Show all commits

View File

@ -1,5 +1,24 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Console\Commands;
use App\Facades\UUID;
@ -23,6 +42,7 @@ class CreateUser extends Command
* @var string
*/
protected $description = 'Creates an application user. Seeding the database is for testing environments, so use this command in production for your first admin user.';
/**
* Create a new command instance.
*
@ -40,9 +60,7 @@ class CreateUser extends Command
*/
public function handle()
{
do
{
do {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
system('cls');
} else {
@ -53,60 +71,43 @@ class CreateUser extends Command
$this->info('We\'ll ask some questions to get you started.');
$username = $this->ask('Username');
do
{
do {
$password = $this->secret('Password');
$password_confirm = $this->secret('Confirm Password');
if ($password === $password_confirm)
{
if ($password === $password_confirm) {
$password = Hash::make($password);
$matches = true;
}
else
{
} else {
$this->error('Password doesn\'t match. Please try again.');
$matches = false;
}
}
while(!$matches);
} while (! $matches);
$email = $this->ask('E-mail address');
$name = $this->ask('First/Last Name');
do
{
try
{
do {
try {
$uuid = UUID::toUUID($this->ask('Minecraft username (Must be a valid Premium account)'));
}
catch (\InvalidArgumentException $e)
{
} catch (\InvalidArgumentException $e) {
$this->error($e->getMessage());
$hasError = true;
}
if (isset($hasError))
{
if (isset($hasError)) {
$continue = true;
}
else
{
} else {
$continue = false;
}
unset($hasError);
}
while($continue);
} while ($continue);
$this->info('Please check if these details are correct: ');
$this->info('Username: ' . $username);
$this->info('Email: ' . $email);
$this->info('Name: ' . $name);
}
while(!$this->confirm('Create user now? You can go back to correct any details.'));
$this->info('Username: '.$username);
$this->info('Email: '.$email);
$this->info('Name: '.$name);
} while (! $this->confirm('Create user now? You can go back to correct any details.'));
$user = User::create([
'uuid' => $uuid,
@ -114,11 +115,10 @@ class CreateUser extends Command
'email' => $email,
'username' => $username,
'originalIP' => '127.0.0.1',
'password' => $password
'password' => $password,
]);
if ($user)
{
if ($user) {
$user->assignRole('admin', 'reviewer', 'user', 'hiringManager');
Profile::create([
'profileShortBio' => 'Random data '.rand(0, 1000),
@ -128,13 +128,12 @@ class CreateUser extends Command
'userID' => $user->id,
]);
$this->info('Account created! You may now login at ' . route('login') . '. Enjoy the app!');
$this->info('Account created! You may now login at '.route('login').'. Enjoy the app!');
return 0;
}
else
{
} else {
$this->error('There was an unknown problem creating the user. There might have been errors above. Please try again.');
return 1;
}
}

View File

@ -1,12 +1,29 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Console\Commands;
use Faker\Factory;
use Faker\Generator;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;
class MakeFile extends Command
@ -25,7 +42,6 @@ class MakeFile extends Command
*/
protected $description = 'Generates test files for the TeamFile model. Use in conjunction with it\'s factory.';
/**
* The faker instance used to obtain dummy text.
*
@ -53,15 +69,14 @@ class MakeFile extends Command
public function handle()
{
$count = $this->argument('count');
$this->info('Creating ' . $this->argument('count') . ' files!');
for ($max = 1; $max < $count; $max++)
{
Storage::disk('local')->put('factory_files/testfile_' . rand(0, 5000) . '.txt', $this->faker->paragraphs(40, true));
$this->info('Creating '.$this->argument('count').' files!');
for ($max = 1; $max < $count; $max++) {
Storage::disk('local')->put('factory_files/testfile_'.rand(0, 5000).'.txt', $this->faker->paragraphs(40, true));
}
$this->info('Finished creating files! They will be randomly picked by the factory.');
return 0;
}
}

View File

@ -37,7 +37,6 @@ class Team extends TeamworkTeam
return $this->belongsToMany('App\Vacancy', 'team_has_vacancy');
}
public function files()
{
return $this->hasMany('App\TeamFile', 'team_id');

View File

@ -1,5 +1,24 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
return [
/*

View File

@ -1,5 +1,24 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
return [
/*
|--------------------------------------------------------------------------

View File

@ -1,23 +1,42 @@
<?php
return array(
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
return [
/*
|--------------------------------------------------------------------------
| One Signal App Id
|--------------------------------------------------------------------------
|
|
*/
|--------------------------------------------------------------------------
| One Signal App Id
|--------------------------------------------------------------------------
|
|
*/
'app_id' => 'YOUR-APP-ID-HERE',
/*
|--------------------------------------------------------------------------
| Rest API Key
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
| Rest API Key
|--------------------------------------------------------------------------
|
|
*/
|
|
*/
'rest_api_key' => 'YOUR-REST-API-KEY-HERE',
'user_auth_key' => 'YOUR-USER-AUTH-KEY'
);
'user_auth_key' => 'YOUR-USER-AUTH-KEY',
];

View File

@ -1,5 +1,24 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Database\Factories;
use App\TeamFile;
@ -27,12 +46,12 @@ class TeamFileFactory extends Factory
return [
'uploaded_by' => rand(1, 10), // Also assuming that the user seeder has ran before
'team_id' => rand(1, 3), // Assuming you create 3 teams beforehand
'name' => $this->faker->file($prefix . 'factory_files', $prefix . 'uploads', false),
'name' => $this->faker->file($prefix.'factory_files', $prefix.'uploads', false),
'caption' => $this->faker->sentence(),
'description' => $this->faker->paragraphs(3, true),
'fs_location' => $this->faker->file($prefix . 'factory_files', $prefix . 'uploads'),
'fs_location' => $this->faker->file($prefix.'factory_files', $prefix.'uploads'),
'extension' => 'txt',
'size' => rand(1, 1000) // random fake size between 0 bytes and 1 mb
'size' => rand(1, 1000), // random fake size between 0 bytes and 1 mb
];
}
}

View File

@ -1,5 +1,24 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

View File

@ -1,5 +1,24 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

View File

@ -1,5 +1,24 @@
<?php
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Database\Seeders;
use App\TeamFile;