This commit is contained in:
ct
2025-06-08 04:39:38 +08:00
parent 862a6bb19e
commit 8d6e86ebb3
40 changed files with 838 additions and 1601 deletions

59
app/Models/MemeMedia.php Normal file
View File

@@ -0,0 +1,59 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Pgvector\Laravel\HasNeighbors;
use Pgvector\Laravel\Vector;
/**
* Class MemeMedia
*
* @property int $id
* @property string $type
* @property string $sub_type
* @property string $name
* @property string $description
* @property string $keywords
* @property uuid $media_1_uuid
* @property uuid|null $media_2_uuid
* @property string $media_1_mime_type
* @property string|null $media_2_mime_type
* @property USER-DEFINED|null $embedding
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
*
* @package App\Models
*/
class MemeMedia extends Model
{
use SoftDeletes, HasNeighbors;
protected $table = 'meme_medias';
protected $casts = [
'media_1_uuid' => 'uuid',
'media_2_uuid' => 'uuid',
'embedding' => Vector::class,
];
protected $fillable = [
'type',
'sub_type',
'name',
'description',
'keywords',
'media_1_uuid',
'media_2_uuid',
'media_1_mime_type',
'media_2_mime_type',
'embedding'
];
}

View File

@@ -1,80 +0,0 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Str;
/**
* Class Video
*
* @property int $id
* @property string|null $external_id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Collection|VideoRender[] $video_renders
*/
class Video extends Model
{
use SoftDeletes;
protected $table = 'videos';
protected $casts = [
'width' => 'int',
'height' => 'int',
'payload' => 'object',
'render_settings' => 'object',
];
protected $fillable = [
'external_id',
'content_type',
'width',
'height',
'aspect_ratio',
'payload',
'render_settings',
];
protected $hidden = [
'id',
];
public function video_renders()
{
return $this->hasMany(VideoRender::class)->orderBy('id', 'DESC');
}
public function video_captions()
{
return $this->hasMany(VideoCaption::class)->orderBy('time', 'ASC');
}
public function video_elements()
{
return $this->hasMany(VideoElement::class)->orderBy('time', 'ASC');
}
public function latest_render()
{
return $this->hasOne(VideoRender::class)->latest();
}
/**
* The "booted" method of the model.
*/
protected static function booted(): void
{
static::creating(function ($model) {
$model->uuid = $model->uuid ?? (string) Str::uuid();
});
}
}

View File

@@ -1,56 +0,0 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class VideoCaption
*
* @property int $id
* @property int $video_id
* @property float $time
* @property float $duration
* @property string $text
* @property string $parameters
* @property string $payload
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
* @property Video $video
*/
class VideoCaption extends Model
{
use SoftDeletes;
protected $table = 'video_captions';
protected $casts = [
'video_id' => 'int',
'time' => 'float',
'duration' => 'float',
'parameters' => 'object',
'words' => 'object',
];
protected $fillable = [
'video_id',
'time',
'duration',
'text',
'parameters',
'words',
];
public function video()
{
return $this->belongsTo(Video::class);
}
}

View File

@@ -1,54 +0,0 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class VideoElement
*
* @property int $id
* @property string|null $original_asset_url
* @property uuid|null $asset_uuid
* @property string|null $asset_url
* @property string $type
* @property float $time
* @property int $track
* @property float $duration
* @property string $parameters
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*/
class VideoElement extends Model
{
use SoftDeletes;
protected $table = 'video_elements';
protected $casts = [
'time' => 'float',
'track' => 'int',
'duration' => 'float',
'parameters' => 'object',
];
protected $fillable = [
'parent_element_id',
'external_reference',
'asset_hash',
'original_asset_url',
'asset_uuid',
'asset_url',
'type',
'time',
'track',
'duration',
'parameters',
];
}

View File

@@ -1,83 +0,0 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Str;
/**
* Class VideoRender
*
* @property int $id
* @property uuid $uuid
* @property string|null $external_id
* @property int|null $video_id
* @property int|null $user_id
* @property string $payload
* @property string $status
* @property Carbon|null $processing_started_at
* @property Carbon|null $processing_finished_at
* @property uuid|null $completed_video_uuid
* @property string|null $completed_video_full_url
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Video|null $video
* @property User|null $user
*/
class VideoRender extends Model
{
use SoftDeletes;
protected $table = 'video_renders';
protected $casts = [
'video_id' => 'int',
'user_id' => 'int',
'processing_started_at' => 'datetime',
'processing_finished_at' => 'datetime',
'payload' => 'object',
];
protected $fillable = [
'uuid',
'external_id',
'video_id',
'user_id',
'payload',
'status',
'processing_started_at',
'processing_finished_at',
'completed_video_uuid',
'completed_video_full_url',
];
protected $hidden = [
'id',
];
public function video()
{
return $this->belongsTo(Video::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
/**
* The "booted" method of the model.
*/
protected static function booted(): void
{
static::creating(function ($model) {
$model->uuid = $model->uuid ?? (string) Str::uuid();
});
}
}