diff --git a/audon-fe/src/views/CreateView.vue b/audon-fe/src/views/CreateView.vue index 84ae00f..9e1a2d0 100644 --- a/audon-fe/src/views/CreateView.vue +++ b/audon-fe/src/views/CreateView.vue @@ -60,7 +60,6 @@ export default { { title: this.$t("form.relationships.mutual"), value: "mutual" }, { title: this.$t("form.relationships.private"), value: "private" }, ], - scheduledAt: null, searchResult: null, searchQuery: "", isCandiadateLoading: false, @@ -193,7 +192,6 @@ export default { const resp = await axios.post("/api/room", payload); if (resp.status === 201) { this.createdRoomID = resp.data; - // this.$router.push({ name: "room", params: { id: resp.data } }); } } catch (error) { this.searchError.message = `Error: ${error}`; diff --git a/room.go b/room.go index 5de163b..ededde4 100644 --- a/room.go +++ b/room.go @@ -54,39 +54,6 @@ func createRoomHandler(c echo.Context) error { coll := mainDB.Collection(COLLECTION_ROOM) now := time.Now().UTC() - if now.After(room.ScheduledAt) { - // host is trying to create an instant room even though there is another instant room that wasn't used, assumed that host won't use such rooms - if cur, err := coll.Find(c.Request().Context(), - bson.D{ - {Key: "host.audon_id", Value: host.AudonID}, - {Key: "ended_at", Value: time.Time{}}, // host didn't close - {Key: "$expr", Value: bson.D{ // instant room - {Key: "$eq", Value: bson.A{"$created_at", "$scheduled_at"}}, - }}, - }); err == nil { - defer cur.Close(c.Request().Context()) - - roomIDsToBeDeleted := []string{} - for cur.Next(c.Request().Context()) { - emptyRoom := new(Room) - if err := cur.Decode(emptyRoom); err == nil { - if !emptyRoom.IsAnyomeInLivekitRoom(c.Request().Context()) { - roomIDsToBeDeleted = append(roomIDsToBeDeleted, emptyRoom.RoomID) - } - } - } - if len(roomIDsToBeDeleted) > 0 { - coll.DeleteMany(c.Request().Context(), bson.D{{ - Key: "room_id", - Value: bson.D{{Key: "$in", Value: roomIDsToBeDeleted}}}, - }) - } - } - - room.ScheduledAt = now - } else { - // TODO: limit the number of rooms one can schedule? - } // TODO: use a job scheduler to manage rooms? @@ -285,11 +252,6 @@ func joinRoomHandler(c echo.Context) (err error) { now := time.Now().UTC() - // check if room is not yet started - if room.ScheduledAt.After(now) { - return echo.NewHTTPError(http.StatusConflict, "not_yet_started") - } - // check if room has already ended if !room.EndedAt.IsZero() && room.EndedAt.Before(now) { return ErrAlreadyEnded diff --git a/schema.go b/schema.go index 95a98db..fb4c44a 100644 --- a/schema.go +++ b/schema.go @@ -42,7 +42,6 @@ type ( CoHosts []*AudonUser `bson:"cohosts" json:"cohosts"` Restriction JoinRestriction `bson:"restriction" json:"restriction"` Kicked []*AudonUser `bson:"kicked" json:"kicked"` - ScheduledAt time.Time `bson:"scheduled_at" json:"scheduled_at"` EndedAt time.Time `bson:"ended_at" json:"ended_at"` CreatedAt time.Time `bson:"created_at" json:"created_at"` Advertise string `bson:"advertise" json:"advertise"`