Skip to content

Commit ea9c276

Browse files
committed
Merge branch 'dev'
2 parents c99a566 + 728deca commit ea9c276

File tree

19 files changed

+286
-48
lines changed

19 files changed

+286
-48
lines changed

.DS_Store

-6 KB
Binary file not shown.

.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ AWS_DEFAULT_REGION=us-east-1
6363
AWS_BUCKET=
6464
AWS_USE_PATH_STYLE_ENDPOINT=false
6565

66-
VITE_APP_NAME="${APP_NAME}"
66+
BUGTRACKLY_SUPPORT_EMAIL="[email protected]"
67+
BUGTRACKLY_VITE_APP_NAME="${APP_NAME}"
6768

6869
BUGTRACKLY_BASELINE=
70+
6971
BUGTRACKLY_USER_AVATAR_STORAGE_PATH="profile-photos"
7072
BUGTRACKLY_PROJECT_PHOTO_STORAGE_PATH="project-photos"
7173
BUGTRACKLY_USER_AVATAR_STORAGE_DISK="public"

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,17 @@ If you discover a security vulnerability within BugTrackly, please send an e-mai
2323
## License
2424

2525
The BugTrackly application is open-sourced software licensed under the [GPL-3.0 license](https://opensource.org/license/gpl-3-0).
26+
27+
28+
---
29+
30+
## Documentation
31+
32+
- Download or clone the repository : `git clone https://github.com/achappard/bugtrackly.git mbugtrackly-instance`
33+
- Install php dependencies by running `composer install`
34+
- Copy the `.env.example` file in a new `.env` file
35+
- Configure application by editing the `.env` file; in particular, access to the database. All the available configurations are documented in the file `config/bugtrackly.php`
36+
- Migrate the database with `php artisan migrate` command.
37+
- Create **the first admin user** by running the interactive command `php artisan bugtrackly:default_user`.
38+
- Run `npm install`
39+
- Run `npm run build`
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Models\User;
6+
use Carbon\Carbon;
7+
use Illuminate\Console\Command;
8+
use Illuminate\Support\Facades\Hash;
9+
10+
class CreateDefaultUser extends Command
11+
{
12+
/**
13+
* The name and signature of the console command.
14+
*
15+
* @var string
16+
*/
17+
protected $signature = 'bugtrackly:default_user';
18+
19+
/**
20+
* The console command description.
21+
*
22+
* @var string
23+
*/
24+
protected $description = 'Create a default user by requesting interactive information';
25+
26+
/**
27+
* Execute the console command.
28+
*/
29+
public function handle()
30+
{
31+
//
32+
$this->info('Creating default admin user...');
33+
$firstName = $this->ask('Enter the user\'s first name');
34+
$lastName = $this->ask('Enter the user name');
35+
$email = $this->ask('Enter the user\'s email address');
36+
$password = $this->secret('Enter a password (will be hidden)');
37+
38+
// Valider que l'email est unique
39+
if (User::where('email', $email)->exists()) {
40+
$this->fail('A user with this email address already exists.');
41+
}
42+
43+
// Créer l'utilisateur
44+
$user = User::create([
45+
'first_name' => $firstName,
46+
'last_name' => $lastName,
47+
'email' => $email,
48+
'role_id' => 1,
49+
'password' => Hash::make($password),
50+
'email_verified_at' => Carbon::now()
51+
]);
52+
53+
$this->info('The user ' . $user->full_name . ' has been created. He is an administrator.');
54+
}
55+
}

app/Models/Bug.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\Helpers\StringHelper;
66
use Illuminate\Database\Eloquent\Casts\Attribute;
7+
use Illuminate\Database\Eloquent\Factories\HasFactory;
78
use Illuminate\Database\Eloquent\Model;
89
use Illuminate\Database\Eloquent\Relations\BelongsTo;
910
use Illuminate\Database\Eloquent\Builder;
@@ -16,6 +17,7 @@
1617

1718
class Bug extends Model
1819
{
20+
use HasFactory;
1921
/**
2022
* Les attributs qui peuvent être assignés en masse.
2123
*
@@ -25,6 +27,7 @@ class Bug extends Model
2527
'title',
2628
'priority',
2729
'status',
30+
// 'user_id', //à delete et tester le seeder....
2831
'assigned_user_id',
2932
];
3033

@@ -54,7 +57,9 @@ protected static function boot()
5457
parent::boot();
5558

5659
static::creating(function (Bug $bug) {
57-
$bug->user_id = Auth::id();
60+
if(empty($bug->user_id)){
61+
$bug->user_id = Auth::id();
62+
}
5863
if (empty($bug->status)) {
5964
$bug->status = 1;
6065
}

app/Models/BugComment.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Models;
44

5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
56
use Illuminate\Database\Eloquent\Model;
67
use Illuminate\Database\Eloquent\Relations\BelongsTo;
78
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -10,6 +11,8 @@
1011

1112
class BugComment extends Model
1213
{
14+
use HasFactory;
15+
1316
/**
1417
* The relations to eager load on every query.
1518
*
@@ -21,15 +24,17 @@ class BugComment extends Model
2124
];
2225

2326
protected $fillable = [
24-
'content'
27+
'content',
2528
];
2629

2730
protected static function boot()
2831
{
2932
parent::boot();
3033

3134
static::creating(function (BugComment $bugComment) {
32-
$bugComment->user_id = Auth::id();
35+
if(empty($bugComment->user_id)){
36+
$bugComment->user_id = Auth::id();
37+
}
3338
});
3439

3540
// Lors de la création d'un bug, on met à jour updated_at du projet
@@ -62,7 +67,7 @@ public function user(): BelongsTo
6267
return $this->belongsTo(User::class);
6368
}
6469

65-
public function files():HasMany
70+
public function files(): HasMany
6671
{
6772
return $this->hasMany(BugCommentFile::class);
6873
}

config/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
'name' => env('APP_NAME', 'Laravel'),
1717

1818

19-
'version' => '1.3.0',
19+
'version' => '1.4.0',
2020

2121
/*
2222
|--------------------------------------------------------------------------

config/bugtrackly.php

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,68 @@
11
<?php
22
return [
3-
'baseline' => env('BUGTRACKLY_BASELINE', 'Traquez les bugs, boostez la qualité'),
3+
/*
4+
|--------------------------------------------------------------------------
5+
| Baseline for app. Displayed in the footer
6+
|--------------------------------------------------------------------------
7+
|
8+
*/
9+
'baseline' => env('BUGTRACKLY_BASELINE', 'Traquez les bugs, boostez la qualité'),
10+
411

5-
'support_email' => env('BUGTRACKLY_SUPPORT_EMAIL', '[email protected]'),
12+
/*
13+
|--------------------------------------------------------------------------
14+
| Support email. Will be displayed in the transactional emails
15+
|--------------------------------------------------------------------------
16+
|
17+
*/
18+
19+
'support_email' => env('BUGTRACKLY_SUPPORT_EMAIL', '[email protected]'),
620
/*
721
|--------------------------------------------------------------------------
822
| Storage path for the profile photo
923
|--------------------------------------------------------------------------
1024
|
1125
*/
12-
'profile_photo_storage_path' => env('BUGTRACKLY_USER_AVATAR_STORAGE_PATH', 'profile-photos'),
26+
'profile_photo_storage_path' => env('BUGTRACKLY_USER_AVATAR_STORAGE_PATH', 'profile-photos'),
1327

1428
/*
1529
|--------------------------------------------------------------------------
1630
| Storage path for the project photo
1731
|--------------------------------------------------------------------------
1832
|
1933
*/
20-
'project_photo_storage_path' => env('BUGTRACKLY_PROJECT_PHOTO_STORAGE_PATH', 'profile-photos'),
34+
'project_photo_storage_path' => env('BUGTRACKLY_PROJECT_PHOTO_STORAGE_PATH', 'profile-photos'),
2135

2236
/*
2337
|--------------------------------------------------------------------------
2438
| Storage disk for the profile photo
2539
|--------------------------------------------------------------------------
2640
|
2741
*/
28-
'profile_photo_disk' => env('BUGTRACKLY_USER_AVATAR_STORAGE_DISK', 'public'),
42+
'profile_photo_disk' => env('BUGTRACKLY_USER_AVATAR_STORAGE_DISK', 'public'),
2943

3044
/*
3145
|--------------------------------------------------------------------------
3246
| Storage disk for the project photo
3347
|--------------------------------------------------------------------------
3448
|
3549
*/
36-
'profile_project_disk' => env('BUGTRACKLY_PROJECT_PHOTO_STORAGE_DISK', 'public'),
50+
'profile_project_disk' => env('BUGTRACKLY_PROJECT_PHOTO_STORAGE_DISK', 'public'),
3751

3852
/*
3953
|--------------------------------------------------------------------------
4054
| Should we use the gravatar service ?
4155
|--------------------------------------------------------------------------
4256
|
4357
*/
44-
'use_gravatar_service' => env('BUGTRACKLY_USER_AVATAR_USE_GRAVATAR', false),
58+
'use_gravatar_service' => env('BUGTRACKLY_USER_AVATAR_USE_GRAVATAR', false),
4559

46-
'use_initiales_as_avatar' => env('BUGTRACKLY_USER_AVATAR_INITIALS', false),
60+
/*
61+
|--------------------------------------------------------------------------
62+
| Should we use the initiales for user ?
63+
|--------------------------------------------------------------------------
64+
|
65+
*/
66+
'use_initiales_as_avatar' => env('BUGTRACKLY_USER_AVATAR_INITIALS', false),
4767

4868
];
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Database\Factories;
4+
5+
use DavidBadura\FakerMarkdownGenerator\FakerProvider;
6+
use Illuminate\Database\Eloquent\Factories\Factory;
7+
8+
/**
9+
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\BugComment>
10+
*/
11+
class BugCommentFactory extends Factory
12+
{
13+
/**
14+
* Define the model's default state.
15+
*
16+
* @return array<string, mixed>
17+
*/
18+
public function definition(): array
19+
{
20+
return [
21+
'bug_id' => null,
22+
'user_id' => null,
23+
'content' => fake()->paragraph(fake()->numberBetween(1, 10)),
24+
];
25+
}
26+
}

database/factories/BugFactory.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Database\Factories;
4+
5+
use Illuminate\Database\Eloquent\Factories\Factory;
6+
use Illuminate\Support\Str;
7+
8+
/**
9+
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Bug>
10+
*/
11+
class BugFactory extends Factory
12+
{
13+
/**
14+
* Define the model's default state.
15+
*
16+
* @return array<string, mixed>
17+
*/
18+
public function definition(): array
19+
{
20+
return [
21+
'title' => fake()->sentence(),
22+
'status' => fake()->numberBetween(1,6),
23+
'priority' => fake()->numberBetween(1,5),
24+
'project_id' => null, // Défini dans le seeder
25+
'user_id' => null, // Défini dans le seeder
26+
];
27+
}
28+
}

0 commit comments

Comments
 (0)