Skip to content

Commit

Permalink
1171 seeking 15 second is too long (#1234)
Browse files Browse the repository at this point in the history
* SeekingTime enum is created for posting the request.

* Seeking time user setting and selection button are added.

* front-end changes and 20s seeking time options is added.

* Updated file

* Updated error messages

* Fixed golangci

* Ran gofmt -s -w on all files

* Ran gofumpt -l -w

* Update live_update.go

* Fixed some bugs caused from gofumpt

* Fixed a bug

---------

Co-authored-by: Sebastian <[email protected]>
  • Loading branch information
barisgul15 and SebiWrn authored Jan 11, 2024
1 parent f1f5e3d commit 96f53da
Show file tree
Hide file tree
Showing 172 changed files with 776 additions and 508 deletions.
5 changes: 3 additions & 2 deletions api/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package api

import (
"errors"
"github.com/gin-gonic/gin"
"net/http"

"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"net/http"
)

type auditRoutes struct {
Expand Down
9 changes: 5 additions & 4 deletions api/audit_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package api

import (
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"net/http"
"testing"

"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/mock_dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/testutils"
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"github.com/matthiasreumann/gomino"
"net/http"
"testing"
)

func TestGetAudits(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions api/bookmarks.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package api

import (
"errors"
"github.com/gin-gonic/gin"
"net/http"
"strconv"

"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"net/http"
"strconv"
)

func configGinBookmarksRouter(router *gin.Engine, daoWrapper dao.DaoWrapper) {
Expand Down
9 changes: 5 additions & 4 deletions api/bookmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ package api
import (
"errors"
"fmt"
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"net/http"
"testing"

"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/mock_dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/testutils"
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"github.com/matthiasreumann/gomino"
"gorm.io/gorm"
"net/http"
"testing"
)

func BookmarksRouterWrapper(r *gin.Engine) {
Expand Down
3 changes: 1 addition & 2 deletions api/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func RegisterRealtimeChatChannel() {
}

req, err := parseChatPayload(message)

if err != nil {
logger.Warn("could not unmarshal request", "err", err)
return
Expand Down Expand Up @@ -93,7 +92,7 @@ func RegisterRealtimeChatChannel() {
},
})

//delete closed sessions every second
// delete closed sessions every second
go func() {
c := time.Tick(time.Second)
for range c {
Expand Down
13 changes: 8 additions & 5 deletions api/chat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"net/http"
"testing"

"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/mock_dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/testutils"
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"github.com/matthiasreumann/gomino"
"gorm.io/gorm"
)
Expand Down Expand Up @@ -77,7 +77,8 @@ func TestMessages(t *testing.T) {
Middlewares: testutils.GetMiddlewares(tools.ErrorHandler, testutils.TUMLiveContext(testutils.TUMLiveContextStudent)),
ExpectedCode: http.StatusOK,
ExpectedResponse: chats,
}}.
},
}.
Method(http.MethodGet).
Url(url).
Run(t, testutils.Equal)
Expand Down Expand Up @@ -141,7 +142,8 @@ func TestActivePoll(t *testing.T) {
Middlewares: testutils.GetMiddlewares(tools.ErrorHandler, testutils.TUMLiveContext(testutils.TUMLiveContextAdmin)),
ExpectedCode: http.StatusOK,
ExpectedResponse: res,
}}.
},
}.
Method(http.MethodGet).
Url(url).
Run(t, testutils.Equal)
Expand Down Expand Up @@ -197,7 +199,8 @@ func TestUsers(t *testing.T) {
Middlewares: testutils.GetMiddlewares(tools.ErrorHandler, testutils.TUMLiveContext(testutils.TUMLiveContextStudent)),
ExpectedCode: http.StatusOK,
ExpectedResponse: usersResponse,
}}.
},
}.
Method(http.MethodGet).
Url(url).
Run(t, testutils.Equal)
Expand Down
15 changes: 8 additions & 7 deletions api/courseimport.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ import (
"context"
"errors"
"fmt"
"html/template"
"net/http"
"strconv"
"strings"
"time"
"unicode"

campusonline "github.com/RBG-TUM/CAMPUSOnline"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/tum"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
uuid "github.com/satori/go.uuid"
"html/template"
"net/http"
"strconv"
"strings"
"time"
"unicode"
)

func (r lectureHallRoutes) postSchedule(c *gin.Context) {
Expand Down Expand Up @@ -215,7 +216,7 @@ func (r lectureHallRoutes) getSchedule(c *gin.Context) {
})
return
}
//todo figure out right token
// todo figure out right token
campus, err := campusonline.New(tools.Cfg.Campus.Tokens[0], "")
if err != nil {
logger.Error("Can't create campus client", "err", err)
Expand Down
25 changes: 13 additions & 12 deletions api/courses.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/RBG-TUM/commons"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/tum"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/meilisearch/meilisearch-go"
uuid "github.com/satori/go.uuid"
"gorm.io/gorm"
"io"
"net/http"
"net/http/httputil"
Expand All @@ -25,6 +15,17 @@ import (
"strconv"
"strings"
"time"

"github.com/RBG-TUM/commons"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/tum"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/meilisearch/meilisearch-go"
uuid "github.com/satori/go.uuid"
"gorm.io/gorm"
)

func configGinCourseRouter(router *gin.Engine, daoWrapper dao.DaoWrapper) {
Expand Down Expand Up @@ -1343,7 +1344,7 @@ func (r coursesRoutes) createCourse(c *gin.Context) {
return
}

//verify teaching term input, should either be Sommersemester 2020 or Wintersemester 2020/21
// verify teaching term input, should either be Sommersemester 2020 or Wintersemester 2020/21
match, err = regexp.MatchString("(Sommersemester [0-9]{4}|Wintersemester [0-9]{4}/[0-9]{2})$", req.TeachingTerm)
if err != nil || !match {
_ = c.Error(tools.RequestError{
Expand Down Expand Up @@ -1481,7 +1482,7 @@ func (r coursesRoutes) deleteCourse(c *gin.Context) {
}

type createCourseRequest struct {
Access string //enrolled, public, hidden or loggedin
Access string // enrolled, public, hidden or loggedin
CourseID string
EnChat bool
EnDL bool
Expand Down
Loading

0 comments on commit 96f53da

Please sign in to comment.