-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/backend/app endpoints #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
1beb3e6
feat: install spatie
utigernils bf2926b
refactor: enable uuid's for spatie
utigernils f358fe0
fix: broken spatie migration
utigernils 5c72ed0
fix: composer lock in git
utigernils 8f4b228
feat: implement permissions
utigernils e28054b
feat: implement rudimentary project creation
utigernils 04291cf
fix: import Str in all models
utigernils 7cb3750
feat; add fillable atributes to all modells
utigernils b2ae2cf
feat: create factories
utigernils df6e9c9
fix: wrong naming conventions
utigernils 4eb4bbd
fix: old user format
utigernils 01ffa88
feat: implement database seeder
utigernils b8372da
refactor: format
utigernils ba36135
refactor: cleanup routes
utigernils 5e050f1
feat; implement all CRUD endpoints
utigernils 278ce34
refactor: remove unused files
utigernils a4c8f5a
fix: add position
utigernils c659ca8
feat; implement foreign keys on the model
utigernils ccfc898
feat: output complete project data
utigernils 0f0092a
refactor: for pushing :)
utigernils fa21778
Update apps/backend/database/migrations/2025_10_04_021216_create_role…
RikoxCode 2405fa7
refactor: remove that stinky piece of shit
utigernils e27d8d3
Merge branch 'main' of https://github.com/RikoxCode/Sesh into feature…
utigernils File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,5 +21,4 @@ | |
| /vendor | ||
| Homestead.json | ||
| Homestead.yaml | ||
| Thumbs.db | ||
| composer.lock | ||
| Thumbs.db | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
|
|
||
| namespace App\Http\Controllers; | ||
|
|
||
| use App\Models\AiRating; | ||
| use App\Http\Requests\AiRating\StoreAiRatingRequest; | ||
| use App\Http\Requests\AiRating\UpdateAiRatingRequest; | ||
|
|
||
| class AiRatingController extends Controller | ||
| { | ||
| public function index() | ||
| { | ||
| return AiRating::all(); | ||
| } | ||
|
|
||
| public function show(string $id) | ||
| { | ||
| return AiRating::findOrFail($id); | ||
| } | ||
|
|
||
| public function store(StoreAiRatingRequest $request) | ||
| { | ||
| $item = AiRating::create($request->validated()); | ||
| return response()->json($item, 201); | ||
| } | ||
|
|
||
| public function update(UpdateAiRatingRequest $request, string $id) | ||
| { | ||
| $item = AiRating::findOrFail($id); | ||
| $item->update($request->validated()); | ||
| return response()->json($item, 200); | ||
| } | ||
|
|
||
| public function delete(string $id) | ||
| { | ||
| AiRating::findOrFail($id)->delete(); | ||
| return response()->json(null, 204); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?php | ||
|
|
||
| namespace App\Http\Controllers; | ||
|
|
||
| use Illuminate\Http\Request; | ||
| use App\Models\Project; | ||
| use App\Models\User; | ||
|
|
||
|
|
||
| class AppController extends Controller | ||
| { | ||
|
|
||
| public function getProject(Project $project) | ||
| { | ||
| if (!$project->isOwnedByUser()) { | ||
| return response()->json(['message' => 'Forbidden'], 403); | ||
| } | ||
|
|
||
| $project->load([ | ||
| 'chapters.sections' => function ($query) { | ||
| $query->with([ | ||
| 'children.textBlocks', | ||
| 'children.tables', | ||
| 'children.images', | ||
| 'children.children', | ||
| 'textBlocks', | ||
| 'tables', | ||
| 'images', | ||
| ]); | ||
| }, | ||
| ]); | ||
|
|
||
|
|
||
| return response()->json($project); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
|
|
||
| namespace App\Http\Controllers; | ||
|
|
||
| use App\Models\Chapter; | ||
| use App\Http\Requests\Chapter\StoreChapterRequest; | ||
| use App\Http\Requests\Chapter\UpdateChapterRequest; | ||
|
|
||
| class ChapterController extends Controller | ||
| { | ||
| public function index() | ||
| { | ||
| return Chapter::all(); | ||
| } | ||
|
|
||
| public function show(string $id) | ||
| { | ||
| return Chapter::findOrFail($id); | ||
| } | ||
|
|
||
| public function store(StoreChapterRequest $request) | ||
| { | ||
| $item = Chapter::create($request->validated()); | ||
| return response()->json($item, 201); | ||
| } | ||
|
|
||
| public function update(UpdateChapterRequest $request, string $id) | ||
| { | ||
| $item = Chapter::findOrFail($id); | ||
| $item->update($request->validated()); | ||
| return response()->json($item, 200); | ||
| } | ||
|
|
||
| public function delete(string $id) | ||
| { | ||
| Chapter::findOrFail($id)->delete(); | ||
| return response()->json(null, 204); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
|
|
||
| namespace App\Http\Controllers; | ||
|
|
||
| use App\Models\Criterion; | ||
| use App\Http\Requests\Criterion\StoreCriterionRequest; | ||
| use App\Http\Requests\Criterion\UpdateCriterionRequest; | ||
|
|
||
| class CriterionController extends Controller | ||
| { | ||
| public function index() | ||
| { | ||
| return Criterion::all(); | ||
| } | ||
|
|
||
| public function show(string $id) | ||
| { | ||
| return Criterion::findOrFail($id); | ||
| } | ||
|
|
||
| public function store(StoreCriterionRequest $request) | ||
| { | ||
| $item = Criterion::create($request->validated()); | ||
| return response()->json($item, 201); | ||
| } | ||
|
|
||
| public function update(UpdateCriterionRequest $request, string $id) | ||
| { | ||
| $item = Criterion::findOrFail($id); | ||
| $item->update($request->validated()); | ||
| return response()->json($item, 200); | ||
| } | ||
|
|
||
| public function delete(string $id) | ||
| { | ||
| Criterion::findOrFail($id)->delete(); | ||
| return response()->json(null, 204); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
|
|
||
| namespace App\Http\Controllers; | ||
|
|
||
| use App\Models\Glossary; | ||
| use App\Http\Requests\Glossary\StoreGlossaryRequest; | ||
| use App\Http\Requests\Glossary\UpdateGlossaryRequest; | ||
|
|
||
| class GlossaryController extends Controller | ||
| { | ||
| public function index() | ||
| { | ||
| return Glossary::all(); | ||
| } | ||
|
|
||
| public function show(string $id) | ||
| { | ||
| return Glossary::findOrFail($id); | ||
| } | ||
|
|
||
| public function store(StoreGlossaryRequest $request) | ||
| { | ||
| $item = Glossary::create($request->validated()); | ||
| return response()->json($item, 201); | ||
| } | ||
|
|
||
| public function update(UpdateGlossaryRequest $request, string $id) | ||
| { | ||
| $item = Glossary::findOrFail($id); | ||
| $item->update($request->validated()); | ||
| return response()->json($item, 200); | ||
| } | ||
|
|
||
| public function delete(string $id) | ||
| { | ||
| Glossary::findOrFail($id)->delete(); | ||
| return response()->json(null, 204); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
|
|
||
| namespace App\Http\Controllers; | ||
|
|
||
| use App\Models\Image; | ||
| use App\Http\Requests\Image\StoreImageRequest; | ||
| use App\Http\Requests\Image\UpdateImageRequest; | ||
|
|
||
| class ImageController extends Controller | ||
| { | ||
| public function index() | ||
| { | ||
| return Image::all(); | ||
| } | ||
|
|
||
| public function show(string $id) | ||
| { | ||
| return Image::findOrFail($id); | ||
| } | ||
|
|
||
| public function store(StoreImageRequest $request) | ||
| { | ||
| $item = Image::create($request->validated()); | ||
| return response()->json($item, 201); | ||
| } | ||
|
|
||
| public function update(UpdateImageRequest $request, string $id) | ||
| { | ||
| $item = Image::findOrFail($id); | ||
| $item->update($request->validated()); | ||
| return response()->json($item, 200); | ||
| } | ||
|
|
||
| public function delete(string $id) | ||
| { | ||
| Image::findOrFail($id)->delete(); | ||
| return response()->json(null, 204); | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
apps/backend/app/Http/Controllers/PermissionController.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
|
|
||
| namespace App\Http\Controllers; | ||
|
|
||
| use App\Models\Permission; | ||
| use App\Http\Requests\Permission\StorePermissionRequest; | ||
| use App\Http\Requests\Permission\UpdatePermissionRequest; | ||
|
|
||
| class PermissionController extends Controller | ||
| { | ||
| public function index() | ||
| { | ||
| return Permission::all(); | ||
| } | ||
|
|
||
| public function show(string $id) | ||
| { | ||
| return Permission::findOrFail($id); | ||
| } | ||
|
|
||
| public function store(StorePermissionRequest $request) | ||
| { | ||
| $item = Permission::create($request->validated()); | ||
| return response()->json($item, 201); | ||
| } | ||
|
|
||
| public function update(UpdatePermissionRequest $request, string $id) | ||
| { | ||
| $item = Permission::findOrFail($id); | ||
| $item->update($request->validated()); | ||
| return response()->json($item, 200); | ||
| } | ||
|
|
||
| public function delete(string $id) | ||
| { | ||
| Permission::findOrFail($id)->delete(); | ||
| return response()->json(null, 204); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <?php | ||
|
|
||
| namespace App\Http\Controllers; | ||
|
|
||
| use Illuminate\Http\Request; | ||
| use App\Models\Project; | ||
| use App\Models\Chapter; | ||
| use App\Http\Requests\Project\StoreProjectRequest; | ||
| use App\Http\Requests\Project\UpdateProjectRequest; | ||
|
|
||
| class ProjectController extends Controller | ||
| { | ||
| public function index() | ||
| { | ||
| return Project::all(); | ||
| } | ||
|
|
||
| public function show(string $id) | ||
| { | ||
| return Project::findOrFail($id); | ||
| } | ||
|
|
||
| public function store(StoreProjectRequest $request) | ||
| { | ||
| $project = Project::create($request->validated()); | ||
| return response()->json($project, 201); | ||
| } | ||
|
|
||
| public function update(UpdateProjectRequest $request, string $id) | ||
| { | ||
| $project = Project::findOrFail($id); | ||
| $project->update($request->validated()); | ||
| return response()->json($project, 200); | ||
| } | ||
|
|
||
| public function delete(string $id) | ||
| { | ||
| Project::findOrFail($id)->delete(); | ||
| return response()->json(null, 204); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.