-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Miguel Ramos
committed
Feb 15, 2021
1 parent
c380705
commit 9a4bbac
Showing
16 changed files
with
321 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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,38 @@ | ||
package models | ||
|
||
import ( | ||
"github.com/gobuffalo/uuid" | ||
"github.com/pkg/errors" | ||
"github.com/websublime/barrel/storage/namespace" | ||
) | ||
|
||
type BucketMedia struct { | ||
ID uuid.UUID `json:"id" db:"id" primary_id:"id"` | ||
BucketID uuid.UUID `json:"bucketId" db:"bucket_id"` | ||
MediaID uuid.UUID `json:"mediaId" db:"media_id"` | ||
} | ||
|
||
func (BucketMedia) TableName() string { | ||
tableName := "bucket_media" | ||
|
||
if namespace.GetNamespace() != "" { | ||
return namespace.GetNamespace() + "." + tableName | ||
} | ||
|
||
return tableName | ||
} | ||
|
||
func NewBucketMedia(bucket uuid.UUID, media uuid.UUID) (*BucketMedia, error) { | ||
uid, err := uuid.NewV4() | ||
if err != nil { | ||
return nil, errors.Wrap(err, "Error generating unique id") | ||
} | ||
|
||
bucketMedia := &BucketMedia{ | ||
ID: uid, | ||
BucketID: bucket, | ||
MediaID: media, | ||
} | ||
|
||
return bucketMedia, nil | ||
} |
Oops, something went wrong.