Skip to content
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

Pedro García ManyRequest Deliver #1

Open
wants to merge 94 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
9108bf5
test: setup for .env.testing file handling
PedGarblue Nov 26, 2024
f4d81e7
feat: prevent model lazy loading
PedGarblue Nov 26, 2024
7fb7f4d
feat: user video base model resource with migrations, seeders and ind…
PedGarblue Nov 26, 2024
a7cc4db
feat: basic video create endpoint
PedGarblue Nov 27, 2024
e01f511
test: refresh database on test case setup
PedGarblue Nov 27, 2024
90e47ae
feat: video basic file store
PedGarblue Nov 27, 2024
f3a4c73
feat: added ffmpeg and multimedia service with video compression
PedGarblue Nov 27, 2024
9129ff5
fix: compressed video stored in wrong disk
PedGarblue Nov 28, 2024
86baa58
feat: process video job
PedGarblue Nov 28, 2024
adeaa5a
feat: added queue with video process job for video create
PedGarblue Nov 28, 2024
c166dda
feat: generate video thumbnail in FFMpeg service
PedGarblue Nov 28, 2024
591da64
feat: generate video thumbnail job
PedGarblue Nov 28, 2024
72974bb
feat: added GenerateVideoThumbnail job to create video queue
PedGarblue Nov 28, 2024
479f47f
feat: getVideoMetadata in MultimediaService
PedGarblue Nov 28, 2024
10169b2
feat: added width and height to video model
PedGarblue Nov 28, 2024
f9ccf52
feat: save video video metadata job
PedGarblue Nov 28, 2024
223b4de
feat: added save video metadata job in video create endpoint
PedGarblue Nov 28, 2024
35d0831
chore: broadcast service with pusher install
PedGarblue Nov 28, 2024
827c2dd
db: added notifications table
PedGarblue Nov 28, 2024
fac282f
feat: send video processing completed notification via mail, database…
PedGarblue Nov 28, 2024
f439cc4
feat: added video processed notification to video create endpoint
PedGarblue Nov 28, 2024
26d1e56
fix: pusher.js config using laravel mix env vars instead of vite vars
PedGarblue Nov 28, 2024
8f97dad
feat: added status field to video model
PedGarblue Nov 28, 2024
009db54
feat: update video status job
PedGarblue Nov 28, 2024
6e8ccec
feat: added update video status job in video create endpoint
PedGarblue Nov 28, 2024
e139bfc
feat: video index endpoint now only lists current auth user videos
PedGarblue Nov 28, 2024
011a7cc
feat: basic user video list and video create
PedGarblue Nov 28, 2024
ccef41e
feat: added notification dropdown in navbar
PedGarblue Nov 28, 2024
e9d8f29
test: reorganize video controller test cases by endpoint
PedGarblue Nov 28, 2024
ed1f889
feat: video update endpoint
PedGarblue Nov 29, 2024
3ebde46
feat: video update edit view
PedGarblue Nov 29, 2024
bd5225c
feat: video delete endpoint and delete button added to user video item
PedGarblue Nov 29, 2024
6fd92a0
feat: base category resource endpoints (create, update, delete)
PedGarblue Nov 29, 2024
3767963
feat: video tag many to many relationship
PedGarblue Nov 29, 2024
bf08655
feat: create and update video tags
PedGarblue Nov 29, 2024
3648a23
feat: user video index now shows tags
PedGarblue Nov 29, 2024
63b43fc
feat: tag input in create and update video forms
PedGarblue Nov 29, 2024
ba44a87
feat: added comment model
PedGarblue Nov 29, 2024
68d135c
feat: added video comment endpoints
PedGarblue Nov 29, 2024
12e9d52
feat: show comment count in video index
PedGarblue Nov 29, 2024
f186db2
feat: show video endpoint and view
PedGarblue Nov 29, 2024
0a77228
feat: textarea input component
PedGarblue Nov 29, 2024
271b8d9
feat(video): added comments in show view
PedGarblue Nov 29, 2024
2588cd6
feat: redirect dashboard to videos index and renamed videos index hea…
PedGarblue Nov 29, 2024
1ba26a5
feat: renamed route Welcome to Home with videos list
PedGarblue Nov 29, 2024
f6d537b
feat(home): videos pagination
PedGarblue Nov 29, 2024
c578627
feat(home): filter videos by title
PedGarblue Nov 29, 2024
027e324
feat(home): filter videos by size
PedGarblue Nov 29, 2024
3c1c9a2
feat(home): filter by video duration
PedGarblue Nov 29, 2024
9fec88f
feat(home): render videos with comments count
PedGarblue Nov 30, 2024
afa589c
feat(home): added public videos list and reworked home
PedGarblue Nov 30, 2024
ac8022c
feat: video tags smaller and full rounded
PedGarblue Nov 30, 2024
13afcf9
feat: new styles for inputs and buttons
PedGarblue Nov 30, 2024
3c971c8
feat(home): video search and filters component
PedGarblue Nov 30, 2024
b3c2d30
fix(home): allow min 0 as value for filtering video by size or duration
PedGarblue Nov 30, 2024
956b167
feat: new styles for App Layout and Navbar
PedGarblue Nov 30, 2024
708ca0f
feat: danger button full rounded
PedGarblue Nov 30, 2024
b76c744
feat(my-videos): reworked UserVideoItem to use VideoItem
PedGarblue Nov 30, 2024
349672d
feat(videos-show): added new colors and responsivity
PedGarblue Nov 30, 2024
c033f78
feat(videos-create): added new colors and responsivity
PedGarblue Nov 30, 2024
8d887e8
feat(video-edit): added new colors and responsivity
PedGarblue Nov 30, 2024
90f2e5e
feat: added new colors to jetstream auth components
PedGarblue Nov 30, 2024
dbf0398
feat: processing state in user video overlay
PedGarblue Nov 30, 2024
beb5f72
feat: Process Video Job when fail set video status as failed and dele…
PedGarblue Nov 30, 2024
2ab4743
feat: video processing failed notification
PedGarblue Nov 30, 2024
8b08c2f
feat: send notfication when process video job fails
PedGarblue Nov 30, 2024
f233537
feat: handle failed video processing notification on video index and …
PedGarblue Nov 30, 2024
246e3d1
fix: missing status attribute in home page videos item
PedGarblue Nov 30, 2024
20989c1
feat: failed video status in user videos item
PedGarblue Nov 30, 2024
c54e235
fix: responsivity for video filters
PedGarblue Nov 30, 2024
3d9fa8d
feat: added public videos pagination component
PedGarblue Nov 30, 2024
66a1bdb
feat: new styles and colors for profile page and jetstream default ac…
PedGarblue Nov 30, 2024
5d7adbc
feat: added simple footer
PedGarblue Nov 30, 2024
bcbc526
feat: added custom logo
PedGarblue Nov 30, 2024
a610977
feat(home): range inputs for size and duration filters
PedGarblue Nov 30, 2024
2db6243
fix: bad types in pagination and home page props
PedGarblue Nov 30, 2024
1b1cb7a
feat: create user video error feedback in component
PedGarblue Nov 30, 2024
0a9f8c0
feat: update user video form errors feedback in component
PedGarblue Nov 30, 2024
c61354d
style: remove unused function in UserVideoItem component
PedGarblue Nov 30, 2024
a067948
feat: retry video processing jobs 3 times with 10s backoff
PedGarblue Nov 30, 2024
8c010cc
chore: updated .env.example
PedGarblue Nov 30, 2024
818eb3c
fix: description attribute too small to handle paragraphs of texts
PedGarblue Nov 30, 2024
2eeb43a
test(videos): improved video tags id match
PedGarblue Nov 30, 2024
ce5112b
test(comment): dont match comment id in comment model test
PedGarblue Nov 30, 2024
48bb861
docs: updated readme
PedGarblue Nov 30, 2024
1e75edd
feat: always grow layout body to max content
PedGarblue Nov 30, 2024
9ea8d7c
fix: page titles in home, video edit and video show
PedGarblue Nov 30, 2024
4563aa9
fix: video item link now only in thumbnail image and title
PedGarblue Nov 30, 2024
90a3d65
fix: range input component min and max props not allowing strings
PedGarblue Nov 30, 2024
3982427
fix: size of "made by" in footer mobile view
PedGarblue Nov 30, 2024
c699cfe
fix: responsivity for application logo in footer
PedGarblue Nov 30, 2024
41f99d1
feat: videos config file and config data added to videos store and up…
PedGarblue Dec 1, 2024
a1b3827
fix: video filters components sets default values instead of null whe…
PedGarblue Dec 1, 2024
b13b468
fix: other users can update / delete any videos
PedGarblue Dec 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_NAME=Laravel
APP_NAME=ManyVideos
APP_ENV=local
APP_KEY=
APP_DEBUG=true
Expand All @@ -12,6 +12,8 @@ APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

VIDEO_MAX_UPLOAD_SIZE_MB=20

PHP_CLI_SERVER_WORKERS=4

BCRYPT_ROUNDS=12
Expand All @@ -21,23 +23,31 @@ LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
BROADCAST_CONNECTION=pusher
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

CACHE_STORE=database
CACHE_PREFIX=

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/vendor
.env
.env.backup
.env.testing
.env.production
.phpactor.json
.phpunit.result.cache
Expand Down
87 changes: 38 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,55 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
# ManyVideos

<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## Installation

## About Laravel
Install dependencies:

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
```bash
php composer install
npm run install
```

- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Generate the app key

Laravel is accessible, powerful, and provides tools required for large, robust applications.
```bash
php artisan key:generate
```

## Learning Laravel
Copy the `.env.example` file to `.env` and fill in the database information

Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
```bash
cp .env.example .env

You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
# REMEMBER SET THE DATABASE INFORMATION AND PUSHER KEYS

If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=

## Laravel Sponsors
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
```

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
Run the migrations

### Premium Partners
```bash
php artisan migrate
```

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[WebReinvent](https://webreinvent.com/)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Jump24](https://jump24.co.uk)**
- **[Redberry](https://redberry.international/laravel/)**
- **[Active Logic](https://activelogic.com)**
- **[byte5](https://byte5.de)**
- **[OP.GG](https://op.gg)**
Run the server

## Contributing
```bash
php artisan serve
```

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
Run the worker

## Code of Conduct
```bash
php artisan queue:work
```

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).

## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
11 changes: 11 additions & 0 deletions app/Enums/VideoStatusEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Enums;

enum VideoStatusEnum: string
{
case Processing = 'processing';
case Processed = 'processed';
case Failed = 'failed';
case Canceled = 'canceled';
}
75 changes: 75 additions & 0 deletions app/Http/Controllers/CommentController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

namespace App\Http\Controllers;

use App\Http\Requests\StoreCommentRequest;
use App\Http\Requests\UpdateCommentRequest;
use App\Models\Comment;
use App\Models\Video;

class CommentController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(StoreCommentRequest $request, Video $video)
{
$user = $request->user();
$comment = $video->comments()->create([
...$request->validated(),
'user_id' => $user->id,
]);

return redirect()->route('videos.show', $video);
}

/**
* Display the specified resource.
*/
public function show(Comment $comment)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(Comment $comment)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(UpdateCommentRequest $request, Video $video, Comment $comment)
{

}

/**
* Remove the specified resource from storage.
*/
public function destroy(Video $video, Comment $comment)
{
$comment->delete();

return redirect()->route('videos.show', $video);
}
}
51 changes: 51 additions & 0 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace App\Http\Controllers;

use App\Enums\VideoStatusEnum;
use App\Http\Requests\IndexHomeRequest;
use App\Models\Video;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;

class HomeController extends Controller
{
public function index(IndexHomeRequest $request)
{
$perpage = $request->perpage ?? 10;

// it will show only the videos that are processed
$videos = Video::where('status', VideoStatusEnum::Processed)
->when($request->search, function ($query, $search) {
$query->where('title', 'like', "%$search%");
})
->when($request->size_min, function ($query, $size_min) {
$size_min = $size_min * 1024 * 1024;
$query->where('size', '>=', $size_min);
})
->when($request->size_max, function ($query, $size_max) {
$size_max = $size_max * 1024 * 1024;
$query->where('size', '<=', $size_max);
})
->when($request->duration_min, function ($query, $duration_min) {
$duration_min = $duration_min * 60;
$query->where('duration', '>=', $duration_min);
})
->when($request->duration_max, function ($query, $duration_max) {
$duration_max = $duration_max * 60;
$query->where('duration', '<=', $duration_max);
})
->withMinAttributes()
->with('user', 'tags')
->withCommentsCount()
->latest()
->paginate($perpage);

return Inertia::render('Home', [
'canLogin' => Route::has('login'),
'canRegister' => Route::has('register'),
'videos' => $videos,
]);
}
}
72 changes: 72 additions & 0 deletions app/Http/Controllers/TagController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace App\Http\Controllers;

use App\Http\Requests\StoreTagRequest;
use App\Http\Requests\UpdateTagRequest;
use App\Models\Tag;

class TagController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{

}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(StoreTagRequest $request)
{
$tag = Tag::create($request->validated());

return response()->json($tag, 201);
}

/**
* Display the specified resource.
*/
public function show(Tag $tag)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(Tag $tag)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(UpdateTagRequest $request, Tag $tag)
{
$tag->update($request->validated());

return response()->json($tag);
}

/**
* Remove the specified resource from storage.
*/
public function destroy(Tag $tag)
{
$tag->delete();

return response()->json(null, 204);
}
}
Loading