Skip to content

Commit 4f5dce7

Browse files
authored
Merge pull request #26 from Sysvale/develop
release v1.1.0
2 parents eec43a0 + d827948 commit 4f5dce7

File tree

80 files changed

+2335
-142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2335
-142
lines changed
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Constants\BoardListsKeys;
6+
use App\Constants\LabelKeys;
7+
use App\Constants\TeamKeys;
8+
use App\Models\BoardList;
9+
use App\Models\Label;
10+
use App\Models\Team;
11+
use Illuminate\Console\Command;
12+
13+
class SetupManagementWorkspace extends Command
14+
{
15+
/**
16+
* The name and signature of the console command.
17+
*
18+
* @var string
19+
*/
20+
protected $signature = 'setup:management-workspace';
21+
22+
/**
23+
* The console command description.
24+
*
25+
* @var string
26+
*/
27+
protected $description = '[Temporário] Configura workspace para o time de gestão';
28+
29+
/**
30+
* Create a new command instance.
31+
*
32+
* @return void
33+
*/
34+
public function __construct()
35+
{
36+
parent::__construct();
37+
}
38+
39+
/**
40+
* Execute the console command.
41+
*
42+
* @return mixed
43+
*/
44+
public function handle()
45+
{
46+
$this->info('Iniciando...');
47+
$this->createLabels();
48+
$this->createTeams();
49+
$this->createSprintBoardLists();
50+
$this->createDoingBoardList();
51+
$this->info('Tudo pronto!');
52+
}
53+
54+
private function createLabels()
55+
{
56+
$managementLabels = [
57+
[
58+
'name' => 'Gente e Gestão',
59+
'key' => LabelKeys::PM,
60+
'color' => '#815AA5',
61+
'text_color' => '#fff',
62+
],
63+
[
64+
'name' => 'Financeiro',
65+
'key' => LabelKeys::FINANCIAL,
66+
'color' => '#028D29',
67+
'text_color' => '#fff',
68+
],
69+
[
70+
'name' => 'Comunicação',
71+
'key' => LabelKeys::COMUNICATION,
72+
'color' => '#FFAA2B',
73+
'text_color' => 'rgba(0, 0, 0, 0.75)',
74+
],
75+
76+
[
77+
'name' => 'Comercial',
78+
'key' => LabelKeys::SALES,
79+
'color' => '#3171A3',
80+
'text_color' => '#fff',
81+
],
82+
[
83+
'name' => 'Projetos',
84+
'key' => LabelKeys::PROJECTS,
85+
'color' => '#54EF1A',
86+
'text_color' => 'rgba(0, 0, 0, 0.75)',
87+
],
88+
[
89+
'name' => 'Reunião',
90+
'key' => LabelKeys::MEET,
91+
'color' => '#EC6646',
92+
'text_color' => '#fff',
93+
],
94+
[
95+
'name' => 'Gestão de cidades',
96+
'key' => LabelKeys::CITY_MANAGEMENT,
97+
'color' => '#97D480',
98+
'text_color' => 'rgba(0, 0, 0, 0.75)',
99+
],
100+
101+
[
102+
'name' => 'Produto',
103+
'key' => LabelKeys::PRODUCT,
104+
'color' => '#21222E',
105+
'text_color' => '#fff',
106+
],
107+
];
108+
109+
$this->info('Criando labels...');
110+
111+
112+
$value = Label::insert($managementLabels);
113+
114+
if ($value) {
115+
$this->info('Labels inseridas com sucesso');
116+
}
117+
}
118+
119+
private function createTeams()
120+
{
121+
$teams = [
122+
[
123+
'name' => 'SysIN',
124+
'key' => TeamKeys::SYS_IN,
125+
'short_task_flow' => true,
126+
],
127+
[
128+
'name' => 'SysOUT',
129+
'key' => TeamKeys::SYS_OUT,
130+
'short_task_flow' => true,
131+
],
132+
];
133+
134+
$this->info('Criando times...');
135+
136+
$value = Team::insert($teams);
137+
138+
if ($value) {
139+
$this->info('Times inseridos com sucesso');
140+
}
141+
}
142+
143+
private function createDoingBoardList()
144+
{
145+
$this->info('Criando doing board list...');
146+
147+
$value = BoardList::create([
148+
'name' => 'Doing',
149+
'key' => BoardListsKeys::DOING,
150+
'position' => 1,
151+
]);
152+
153+
if ($value) {
154+
$this->info('Doing board list criado com sucesso');
155+
}
156+
}
157+
158+
private function createSprintBoardLists()
159+
{
160+
$teams = Team::all();
161+
162+
$this->info('Criando sprint board lists...');
163+
164+
$teams->each(function ($team) {
165+
$board_list = BoardList::where('key', $team->key)->count();
166+
if ($board_list === 0) {
167+
$value = BoardList::create([
168+
'name' => 'Sprint - '. $team->name,
169+
'key' => $team->key,
170+
'user_story_holder' => true,
171+
'position' => 3,
172+
]);
173+
174+
if ($value) {
175+
$this->info('Lista criada com sucesso...');
176+
}
177+
}
178+
});
179+
}
180+
}

app/Constants/BoardListsKeys.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class BoardListsKeys extends BagOfConstants
66
{
77
const TODO = 'todo';
88
const DEVELOPMENT = 'development';
9+
const DOING = 'doing';
910
const CODE_REVIEW = 'codeReview';
1011
const DONE = 'done';
1112
const DEPLOY = 'deploy';
@@ -27,6 +28,12 @@ class BoardListsKeys extends BagOfConstants
2728
self::DEPLOY
2829
];
2930

31+
const SHORTED_LISTS = [
32+
self::TODO,
33+
self::DOING,
34+
self::DONE,
35+
];
36+
3037
const EXTENDED_LISTS = [
3138
self::PO_REVIEW,
3239
self::REVIEWED

app/Constants/LabelKeys.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,11 @@ class LabelKeys extends BagOfConstants
1616
const UX = 'ux';
1717
const APP = 'app';
1818
const EXPORT = 'export';
19+
const FINANCIAL = 'financial';
20+
const PM = 'pm';
21+
const COMUNICATION = 'comunication';
22+
const SALES = 'sales';
23+
const PROJECTS = 'projects';
24+
const CITY_MANAGEMENT = 'cityManagement';
25+
const PRODUCT = 'product';
1926
}

app/Constants/TeamKeys.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ class TeamKeys extends BagOfConstants
77
const AVENGERS = 'avangers';
88
const STEPPER = 'stepper';
99
const BREAKOUT_ONE = 'breakoutOne';
10+
const SYS_IN = 'sysIn';
11+
const SYS_OUT = 'sysOut';
1012
}

app/Events/UserRegisteredEvent.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
use Illuminate\Broadcasting\Channel;
6+
use Illuminate\Broadcasting\InteractsWithSockets;
7+
use Illuminate\Broadcasting\PresenceChannel;
8+
use Illuminate\Broadcasting\PrivateChannel;
9+
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
10+
use Illuminate\Foundation\Events\Dispatchable;
11+
use Illuminate\Queue\SerializesModels;
12+
13+
use App\User;
14+
15+
class UserRegisteredEvent
16+
{
17+
use Dispatchable, InteractsWithSockets, SerializesModels;
18+
public $user;
19+
20+
/**
21+
* Create a new event instance.
22+
*
23+
* @return void
24+
*/
25+
public function __construct(User $user)
26+
{
27+
$this->user = $user;
28+
}
29+
30+
/**
31+
* Get the channels the event should broadcast on.
32+
*
33+
* @return \Illuminate\Broadcasting\Channel|array
34+
*/
35+
public function broadcastOn()
36+
{
37+
return new PrivateChannel('channel-name');
38+
}
39+
}

app/Http/Controllers/BoardListController.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use App\Constants\BoardListsKeys;
66
use App\Models\BoardList;
77
use App\Models\Team;
8+
use App\Models\Workspace;
89
use Illuminate\Http\Request;
910

1011
class BoardListController extends Controller
@@ -32,13 +33,13 @@ public function getDevlogLists(Request $in)
3233
->values();
3334
}
3435

35-
public function getPlanningLists()
36+
public function getPlanningLists(Workspace $workspace)
3637
{
3738
$planningLists = [
3839
BoardListsKeys::BACKLOG,
3940
];
4041

41-
$teams = Team::get();
42+
$teams = Team::where('workspace_id', $workspace->id)->get();
4243
$planningLists = array_merge(
4344
$planningLists,
4445
$teams->map(
@@ -76,11 +77,15 @@ private function getDefaultTaskLists($team_id)
7677
$default_lists = BoardListsKeys::DEFAULT_LISTS;
7778

7879
if ($team_id) {
79-
$extended_task_flow = Team::where('_id', $team_id)
80-
->first()
81-
->extended_task_flow;
82-
if ($extended_task_flow) {
83-
$default_lists = array_merge($default_lists, BoardListsKeys::EXTENDED_LISTS);
80+
$team = Team::where('_id', $team_id)
81+
->first();
82+
83+
if ($team->short_task_flow) {
84+
return BoardListsKeys::SHORTED_LISTS;
85+
}
86+
87+
if ($team->extended_task_flow) {
88+
return array_merge($default_lists, BoardListsKeys::EXTENDED_LISTS);
8489
}
8590
}
8691

app/Http/Controllers/CardController.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,15 @@ public function store(Request $in)
104104
$card->is_user_story = true;
105105
$card->save();
106106
}
107+
108+
unset($card->boardList);
107109

108110
return $card;
109111
}
110112

111113
public function update(Request $in, $id)
112114
{
113115
$params = [
114-
'board_list_id' => $in->board_list_id ?? $in->board_list['id'],
115116
'title' => $in->title,
116117
'link' => $in->link,
117118
'labels' => $in->labels,
@@ -122,19 +123,19 @@ public function update(Request $in, $id)
122123
'checklist' => $in->checklist,
123124
'board_id' => $in->board_id ?? $in->board['id'],
124125
];
126+
127+
$query = Card::where('_id', $id);
128+
$query->update($params);
125129

126-
$list_key = BoardList::where('_id', $params['board_list_id'])->first()->key;
130+
$card = $query->get()->first();
127131

128-
if ($this->isListAnUserStoryHolder($list_key)) {
129-
$params['is_user_story'] = true;
130-
} else {
131-
$params['is_user_story'] = false;
132-
}
132+
$list_key = BoardList::where('_id', $card->boardList->id)->first()->key;
133+
134+
$card->is_user_story = $this->isListAnUserStoryHolder($list_key);
133135

134-
$card = Card::where('_id', $id);
135-
$card->update($params);
136+
$card->save();
136137

137-
return $card->get()->first();
138+
return $card;
138139
}
139140

140141
public function updateCardsPositions(Request $in)

0 commit comments

Comments
 (0)