mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-14 19:22:14 +01:00
add dashboard frontend
This commit is contained in:
@@ -28,6 +28,8 @@ class ProjectController extends Controller
|
||||
* Get projects
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId getProjects
|
||||
*/
|
||||
public function index(Organization $organization): JsonResource
|
||||
{
|
||||
@@ -43,6 +45,8 @@ class ProjectController extends Controller
|
||||
* Get project
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId getProject
|
||||
*/
|
||||
public function show(Organization $organization, Project $project): JsonResource
|
||||
{
|
||||
@@ -57,6 +61,8 @@ class ProjectController extends Controller
|
||||
* Create project
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId createProject
|
||||
*/
|
||||
public function store(Organization $organization, ProjectStoreRequest $request): JsonResource
|
||||
{
|
||||
@@ -75,6 +81,8 @@ class ProjectController extends Controller
|
||||
* Update project
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId updateProject
|
||||
*/
|
||||
public function update(Organization $organization, Project $project, ProjectUpdateRequest $request): JsonResource
|
||||
{
|
||||
@@ -90,6 +98,8 @@ class ProjectController extends Controller
|
||||
* Delete project
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId deleteProject
|
||||
*/
|
||||
public function destroy(Organization $organization, Project $project): JsonResponse
|
||||
{
|
||||
|
||||
@@ -27,6 +27,8 @@ class TagController extends Controller
|
||||
* Get tags
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId getTags
|
||||
*/
|
||||
public function index(Organization $organization): TagCollection
|
||||
{
|
||||
@@ -44,6 +46,8 @@ class TagController extends Controller
|
||||
* Create tag
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId createTag
|
||||
*/
|
||||
public function store(Organization $organization, TagStoreRequest $request): TagResource
|
||||
{
|
||||
@@ -61,6 +65,8 @@ class TagController extends Controller
|
||||
* Update tag
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId updateTag
|
||||
*/
|
||||
public function update(Organization $organization, Tag $tag, TagUpdateRequest $request): TagResource
|
||||
{
|
||||
@@ -76,6 +82,8 @@ class TagController extends Controller
|
||||
* Delete tag
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId deleteTag
|
||||
*/
|
||||
public function destroy(Organization $organization, Tag $tag): JsonResponse
|
||||
{
|
||||
|
||||
@@ -32,6 +32,8 @@ class TimeEntryController extends Controller
|
||||
* Get time entries
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId getTimeEntries
|
||||
*/
|
||||
public function index(Organization $organization, TimeEntryIndexRequest $request): JsonResource
|
||||
{
|
||||
@@ -103,6 +105,8 @@ class TimeEntryController extends Controller
|
||||
* Create time entry
|
||||
*
|
||||
* @throws AuthorizationException|TimeEntryStillRunning
|
||||
*
|
||||
* @operationId createTimeEntry
|
||||
*/
|
||||
public function store(Organization $organization, TimeEntryStoreRequest $request): JsonResource
|
||||
{
|
||||
@@ -120,7 +124,7 @@ class TimeEntryController extends Controller
|
||||
|
||||
$timeEntry = new TimeEntry();
|
||||
$timeEntry->fill($request->validated());
|
||||
$timeEntry->description = $request->get('description', '');
|
||||
$timeEntry->description = $request->get('description') ?? '';
|
||||
$timeEntry->organization()->associate($organization);
|
||||
$timeEntry->save();
|
||||
|
||||
@@ -131,6 +135,8 @@ class TimeEntryController extends Controller
|
||||
* Update time entry
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId updateTimeEntry
|
||||
*/
|
||||
public function update(Organization $organization, TimeEntry $timeEntry, TimeEntryUpdateRequest $request): JsonResource
|
||||
{
|
||||
@@ -141,6 +147,7 @@ class TimeEntryController extends Controller
|
||||
}
|
||||
|
||||
$timeEntry->fill($request->validated());
|
||||
$timeEntry->description = $request->get('description', $timeEntry->description) ?? '';
|
||||
$timeEntry->save();
|
||||
|
||||
return new TimeEntryResource($timeEntry);
|
||||
@@ -150,6 +157,8 @@ class TimeEntryController extends Controller
|
||||
* Delete time entry
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*
|
||||
* @operationId deleteTimeEntry
|
||||
*/
|
||||
public function destroy(Organization $organization, TimeEntry $timeEntry): JsonResponse
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ class TimeEntryUpdateRequest extends FormRequest
|
||||
],
|
||||
// End of time entry (ISO 8601 format, UTC timezone)
|
||||
'end' => [
|
||||
'required',
|
||||
'present',
|
||||
'nullable',
|
||||
'date', // TODO
|
||||
'after:start',
|
||||
|
||||
@@ -30,8 +30,8 @@ class TimeEntryResource extends BaseResource
|
||||
/**
|
||||
* @var string|null $end End of time entry (ISO 8601 format, UTC timezone, example: 2024-02-26T17:17:17Z)
|
||||
*/
|
||||
'end' => $this->formatDateTime($this->resource->start),
|
||||
/** @var int $duration Duration of time entry in seconds */
|
||||
'end' => $this->formatDateTime($this->resource->end),
|
||||
/** @var int|null $duration Duration of time entry in seconds */
|
||||
'duration' => $this->resource->getDuration()?->seconds,
|
||||
/** @var string|null $description Description of time entry */
|
||||
'description' => $this->resource->description,
|
||||
@@ -42,7 +42,7 @@ class TimeEntryResource extends BaseResource
|
||||
/** @var string $user_id ID of user */
|
||||
'user_id' => $this->resource->user_id,
|
||||
/** @var array<string> $tags List of tag IDs */
|
||||
'tags' => $this->resource->tags,
|
||||
'tags' => $this->resource->tags ?? [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user