Skip to content

Commit

Permalink
Update streams.go
Browse files Browse the repository at this point in the history
  • Loading branch information
carlobortolan committed Nov 29, 2024
1 parent b696cc3 commit 1aae798
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion dao/streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import (
"context"
"fmt"
"strconv"
"strings"
"time"

"gorm.io/gorm/clause"

"github.com/TUM-Dev/gocast/model"
uuid "github.com/satori/go.uuid"
"gorm.io/gorm"
)

Expand Down Expand Up @@ -382,7 +384,21 @@ func (d streamsDao) CreateOrGetTestStreamAndCourse(user *model.User) (model.Stre
return model.Stream{}, model.Course{}, err
}

return stream, course, nil
stream.Start = time.Now().Add(5 * time.Minute)
stream.End = time.Now().Add(1 * time.Hour)
stream.LiveNow = true
stream.Recording = true
stream.LiveNowTimestamp = time.Now().Add(5 * time.Minute)
stream.Private = true
streamKey := uuid.NewV4().String()
stream.StreamKey = strings.ReplaceAll(streamKey, "-", "")
stream.LectureHallID = 1
err = DB.Save(&stream).Error
if err != nil {
return model.Stream{}, model.Course{}, err
}

return stream, course, err
}

// Helper method to fetch test course for current user.
Expand Down

0 comments on commit 1aae798

Please sign in to comment.