Added Optional channel description name to channel creation, adjusted tests
This commit is contained in:
@@ -58,7 +58,15 @@ func (db *Database) GetChannelByID(ctx db.TxContext, chanid models.ChannelID) (*
|
||||
return &channel, nil
|
||||
}
|
||||
|
||||
func (db *Database) CreateChannel(ctx db.TxContext, userid models.UserID, dispName string, intName string, subscribeKey string) (models.Channel, error) {
|
||||
type CreateChanel struct {
|
||||
UserId models.UserID
|
||||
DisplayName string
|
||||
IntName string
|
||||
SubscribeKey string
|
||||
Description *string
|
||||
}
|
||||
|
||||
func (db *Database) CreateChannel(ctx db.TxContext, channel CreateChanel) (models.Channel, error) {
|
||||
tx, err := ctx.GetOrCreateTransaction(db)
|
||||
if err != nil {
|
||||
return models.Channel{}, err
|
||||
@@ -66,10 +74,11 @@ func (db *Database) CreateChannel(ctx db.TxContext, userid models.UserID, dispNa
|
||||
|
||||
entity := models.ChannelDB{
|
||||
ChannelID: models.NewChannelID(),
|
||||
OwnerUserID: userid,
|
||||
DisplayName: dispName,
|
||||
InternalName: intName,
|
||||
SubscribeKey: subscribeKey,
|
||||
OwnerUserID: channel.UserId,
|
||||
DisplayName: channel.DisplayName,
|
||||
InternalName: channel.IntName,
|
||||
SubscribeKey: channel.SubscribeKey,
|
||||
DescriptionName: channel.Description,
|
||||
TimestampCreated: time2DB(time.Now()),
|
||||
TimestampLastSent: nil,
|
||||
MessagesSent: 0,
|
||||
|
Reference in New Issue
Block a user