Skip to content

Commit

Permalink
filter for status inside track of proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
scammo committed Jan 4, 2024
1 parent 0dfcbc8 commit 9cd5090
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions backend/app/Http/Controllers/TrackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Support\Facades\Auth;
use App\Models\Track;
use App\Models\User;
use App\Models\Proposal;

class TrackController extends Controller
{
Expand Down Expand Up @@ -70,10 +71,16 @@ public function proposals(Request $request)
abort(403);
}
$user = Auth::user();
$track = Track::where('slug', $request->slug)->with('users', 'proposals', 'proposals.opinions')->firstOrFail();
$track = Track::where('slug', $request->slug)->with('users')->firstOrFail();
if(!$track->users->contains($user->id)){
abort(403);
}
return $track->only('users', 'proposals');

$proposals = Proposal::where('track_id', $track->id)->where('status', $request->proposalStatus)->with('opinions', 'opinions.user')->get();

return [
'proposals' => $proposals,
'users' => $track->users,
];
}
}
2 changes: 1 addition & 1 deletion frontend/src/views/orga/ProposalsTrack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const loadPoposals = async () => {
loading.value = true;
try {
const response = await client.get(`track/proposals?slug=${route.params.slug}`)
const response = await client.get(`track/proposals?slug=${route.params.slug}&proposalStatus=${proposalStatus.value}`)
let data = response.data.proposals
trackUsers.value = response.data.users
Expand Down

0 comments on commit 9cd5090

Please sign in to comment.