all: make seaweedfs_fid a string again

This commit is contained in:
Lucas 2023-03-08 20:44:54 +00:00
parent ba099af452
commit ff017f924b
4 changed files with 8 additions and 9 deletions

View File

@ -4,7 +4,6 @@ use strict;
use warnings; use warnings;
use Mojo::Base "Mojolicious::Controller"; use Mojo::Base "Mojolicious::Controller";
use SeaweedFS::FID;
my $MEDIA_SEARCH_OPTS = { my $MEDIA_SEARCH_OPTS = {
order_by => { -desc => "media_id" }, order_by => { -desc => "media_id" },
@ -32,7 +31,7 @@ sub list ($self)
->search({}, $MEDIA_SEARCH_OPTS)->page($page); ->search({}, $MEDIA_SEARCH_OPTS)->page($page);
my @media = map +{ my @media = map +{
media_id => $_->media_id, media_id => $_->media_id,
seaweedfs_fid => SeaweedFS::FID->from_bin($_->seaweedfs_fid), seaweedfs_fid => $_->seaweedfs_fid,
}, $paged_media->all; }, $paged_media->all;
return $self->render(json => { return $self->render(json => {

View File

@ -76,7 +76,7 @@ sub show ($self)
->page($page); ->page($page);
my @media = map +{ my @media = map +{
media_id => $_->media_id, media_id => $_->media_id,
seaweedfs_fid => SeaweedFS::FID->from_bin($_->media_seaweedfs_fid), seaweedfs_fid => $_->media_seaweedfs_fid,
}, $paged_media->all; }, $paged_media->all;
return $self->render(json => { return $self->render(json => {

View File

@ -31,9 +31,9 @@ __PACKAGE__->table("media");
=head2 seaweedfs_fid =head2 seaweedfs_fid
data_type: 'blob' data_type: 'text'
is_nullable: 0 is_nullable: 0
size: 32 size: 35
=head2 filename =head2 filename
@ -53,7 +53,7 @@ __PACKAGE__->add_columns(
"media_id", "media_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"seaweedfs_fid", "seaweedfs_fid",
{ data_type => "blob", is_nullable => 0, size => 32 }, { data_type => "text", is_nullable => 0, size => 35 },
"filename", "filename",
{ data_type => "text", is_nullable => 0, size => 256 }, { data_type => "text", is_nullable => 0, size => 256 },
"content_type", "content_type",
@ -100,8 +100,8 @@ Composing rels: L</media_tags> -> tag
__PACKAGE__->many_to_many("tags", "media_tags", "tag"); __PACKAGE__->many_to_many("tags", "media_tags", "tag");
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-05 13:14:18 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-06 09:09:55
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gY4mMvaQ+cUpA3gtQc9pjg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kIWqStRENiX11XbLnnhJkg
# You can replace this text with custom code or comments, and it will be preserved on regeneration # You can replace this text with custom code or comments, and it will be preserved on regeneration

View File

@ -1,6 +1,6 @@
CREATE TABLE media( CREATE TABLE media(
media_id INTEGER PRIMARY KEY, media_id INTEGER PRIMARY KEY,
seaweedfs_fid BLOB (32) NOT NULL, seaweedfs_fid TEXT (35) NOT NULL,
filename TEXT (256) NOT NULL, filename TEXT (256) NOT NULL,
content_type TEXT (256) content_type TEXT (256)
); );