Added Optional channel description name to channel creation, adjusted tests
All checks were successful
Build Docker and Deploy / Build Docker Container (push) Successful in 2m22s
Build Docker and Deploy / Deploy to Server (push) Successful in 11s

This commit is contained in:
2024-02-24 12:20:41 +01:00
parent 51f5f1005a
commit 77cfe75043
4 changed files with 44 additions and 7 deletions

View File

@@ -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,