feat: support export media
This commit is contained in:
@@ -20,10 +20,11 @@ import (
|
||||
)
|
||||
|
||||
type DBChannel struct {
|
||||
UUID int64
|
||||
Username string
|
||||
Title string
|
||||
MinID int
|
||||
UUID int64
|
||||
Username string
|
||||
Title string
|
||||
MinID int
|
||||
ExportMedia bool
|
||||
}
|
||||
|
||||
func NewDBChannel(uuid int64, username, title string) *DBChannel {
|
||||
@@ -68,13 +69,14 @@ func (c *DBChannel) Get(ctx context.Context) error {
|
||||
if errors.Is(err, qrm.ErrNoRows) {
|
||||
// create new channel with default value
|
||||
m = model.Channels{
|
||||
UUID: c.UUID,
|
||||
Username: c.Username,
|
||||
Title: c.Title,
|
||||
MinID: 0,
|
||||
Offset: 0,
|
||||
CreatedAt: lo.ToPtr(time.Now()),
|
||||
UpdatedAt: lo.ToPtr(time.Now()),
|
||||
UUID: c.UUID,
|
||||
Username: c.Username,
|
||||
Title: c.Title,
|
||||
MinID: 0,
|
||||
Offset: 0,
|
||||
ExportMedia: false,
|
||||
CreatedAt: lo.ToPtr(time.Now()),
|
||||
UpdatedAt: lo.ToPtr(time.Now()),
|
||||
}
|
||||
|
||||
if _, err := tbl.INSERT(tbl.AllColumns.Except(tbl.ID)).MODEL(m).ExecContext(ctx, db); err != nil {
|
||||
@@ -85,6 +87,7 @@ func (c *DBChannel) Get(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
c.MinID = int(m.MinID)
|
||||
c.ExportMedia = m.ExportMedia
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user