diff --git a/app/Http/Controllers/Api/ActivitiesController.php b/app/Http/Controllers/Api/ActivitiesController.php new file mode 100644 index 00000000..ae114ba6 --- /dev/null +++ b/app/Http/Controllers/Api/ActivitiesController.php @@ -0,0 +1,21 @@ +get('apiKey'); + + $activities = Activity::ofSpace($apiKey->user->spaces()->first()->id)->get(); + + return ActivityResource::collection($activities); + } +} diff --git a/app/Http/Resources/ActivityResource.php b/app/Http/Resources/ActivityResource.php new file mode 100644 index 00000000..88f5912b --- /dev/null +++ b/app/Http/Resources/ActivityResource.php @@ -0,0 +1,22 @@ + $this->user + ? ['id' => $this->user->id, 'name' => $this->user->name] + : null, + 'entity_id' => $this->entity_id, + 'entity_type' => $this->entity_type, + 'action' => $this->action, + 'occurred_at' => $this->created_at, + ]; + } +} diff --git a/resources/assets/js/prototype/app.js b/resources/assets/js/prototype/app.js index 55b89311..73ba748b 100644 --- a/resources/assets/js/prototype/app.js +++ b/resources/assets/js/prototype/app.js @@ -7,6 +7,7 @@ import Login from './screens/Login.vue'; import Dashboard from './screens/Dashboard.vue'; import TransactionsIndex from './screens/Transactions/Index.vue'; import TransactionsCreate from './screens/Transactions/Create.vue'; +import Activities from './screens/Activities.vue'; import SettingsPreferences from './screens/Settings/Preferences.vue'; Vue.prototype.versionNumber = window.versionNumber; @@ -30,6 +31,10 @@ const routes = [ path: '/prototype/transactions/create', name: 'transactions.create', component: TransactionsCreate, + }, { + path: '/prototype/activities', + name: 'activities', + component: Activities, }, { path: '/prototype/settings/preferences', name: 'settings.preferences', diff --git a/resources/assets/js/prototype/components/Navigation.vue b/resources/assets/js/prototype/components/Navigation.vue index 31a15bb2..5a5a24c2 100644 --- a/resources/assets/js/prototype/components/Navigation.vue +++ b/resources/assets/js/prototype/components/Navigation.vue @@ -1,5 +1,5 @@ + + + + + + + + + + + + + {{ activity.user ? activity.user.name : 'Budget' }} {{ activity.action.split('.')[1] }} {{ activity.action.split('.')[0] }} #{{ activity.entity_id }} + + {{ new Date(activity.occurred_at).toJSON().split('T')[0] }} + + + + + + + + + + diff --git a/routes/api.php b/routes/api.php index d9e3b0ee..e47f747e 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,5 +1,6 @@ only(['index']); + Route::get('/activities', ActivitiesController::class); + Route::resource('settings', SettingsController::class) ->only(['index', 'store']); });