(svc *service.Container)
| 46 | MaxSizeGB float64 `json:"max_size_gb"` |
| 47 | FreeOnly bool `json:"free_only"` |
| 48 | WashEnabled bool `json:"wash_enabled"` |
| 49 | WashPriority string `json:"wash_priority"` |
| 50 | TotalEpisodes int `json:"total_episodes"` |
| 51 | Priority int `json:"priority"` |
| 52 | Enabled *bool `json:"enabled"` |
| 53 | } |
| 54 | |
| 55 | func createSubscriptionHandler(svc *service.Container) gin.HandlerFunc { |
| 56 | return func(c *gin.Context) { |
| 57 | var req subscriptionReq |
| 58 | if err := c.ShouldBindJSON(&req); err != nil { |
| 59 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 60 | return |
| 61 | } |
| 62 | uid, _ := c.Get(middleware.CtxUserID) |
| 63 | enabled := true |
| 64 | if req.Enabled != nil { |
| 65 | enabled = *req.Enabled |
| 66 | } |
| 67 | s := &model.Subscription{ |
| 68 | UserID: uid.(string), |
| 69 | Name: req.Name, |
| 70 | FeedURL: req.FeedURL, |
| 71 | DeliveryMode: req.DeliveryMode, |
| 72 | LibraryID: req.LibraryID, |
| 73 | LibraryRootID: req.LibraryRootID, |
| 74 | ResourceSource: req.ResourceSource, |
| 75 | MaxImportsPerRun: req.MaxImportsPerRun, |
| 76 | PollIntervalMinutes: req.PollIntervalMinutes, |
| 77 | SeasonNumber: req.SeasonNumber, |
| 78 | Filter: req.Filter, |
| 79 | MediaType: req.MediaType, |
| 80 | MediaCategory: req.MediaCategory, |
| 81 | SavePath: req.SavePath, |
| 82 | SearchMode: req.SearchMode, |
| 83 | IMDBID: req.IMDBID, |
| 84 | Source: req.Source, |
| 85 | PosterURL: req.PosterURL, |
| 86 | BackdropURL: req.BackdropURL, |
| 87 | Overview: req.Overview, |
| 88 | OriginalName: req.OriginalName, |
| 89 | Year: req.Year, |
| 90 | Resolution: req.Resolution, |
| 91 | Quality: req.Quality, |
| 92 | Effects: req.Effects, |
| 93 | ReleaseGroups: req.ReleaseGroups, |
| 94 | ExcludeWords: req.ExcludeWords, |
| 95 | MinSeeders: req.MinSeeders, |
| 96 | MaxSeeders: req.MaxSeeders, |
| 97 | MinSizeGB: req.MinSizeGB, |
| 98 | MaxSizeGB: req.MaxSizeGB, |
| 99 | FreeOnly: req.FreeOnly, |
| 100 | WashEnabled: req.WashEnabled, |
| 101 | WashPriority: req.WashPriority, |
| 102 | TotalEpisodes: req.TotalEpisodes, |
| 103 | Priority: req.Priority, |
| 104 | Enabled: enabled, |
| 105 | } |
no test coverage detected