From 9a267465a7ab5cf1eda73966e86f77aaf727daf7 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 30 Mar 2019 00:09:43 +0000 Subject: [PATCH] Added the calendar! --- src/Ombi.Core/Engine/V2/CalendarEngine.cs | 53 ++++++++++++++ src/Ombi.Core/Engine/V2/ICalendarEngine.cs | 11 +++ .../Models/Search/V2/CalendarViewModel.cs | 10 +++ src/Ombi.DependencyInjection/IocExtensions.cs | 1 + src/Ombi/ClientApp/angular.json | 6 +- src/Ombi/ClientApp/package.json | 3 +- src/Ombi/ClientApp/src/app/app.module.ts | 1 + .../src/app/calendar/calendar.module.ts | 39 ++++++++++ .../components/calendar.component.html | 3 + .../components/calendar.component.scss | 5 ++ .../calendar/components/calendar.component.ts | 66 +++++++++++++++++ .../src/app/calendar/components/index.ts | 5 ++ .../ClientApp/src/app/interfaces/ICalendar.ts | 5 ++ .../src/app/my-nav/my-nav.component.ts | 1 + .../src/app/services/calendar.service.ts | 18 +++++ .../app/shared/functions/common-functions.ts | 3 +- src/Ombi/ClientApp/yarn.lock | 73 +++++++++++++++++-- .../Controllers/V2/CallendarController.cs | 31 ++++++++ src/Ombi/wwwroot/translations/en.json | 3 +- 19 files changed, 326 insertions(+), 11 deletions(-) create mode 100644 src/Ombi.Core/Engine/V2/CalendarEngine.cs create mode 100644 src/Ombi.Core/Engine/V2/ICalendarEngine.cs create mode 100644 src/Ombi.Core/Models/Search/V2/CalendarViewModel.cs create mode 100644 src/Ombi/ClientApp/src/app/calendar/calendar.module.ts create mode 100644 src/Ombi/ClientApp/src/app/calendar/components/calendar.component.html create mode 100644 src/Ombi/ClientApp/src/app/calendar/components/calendar.component.scss create mode 100644 src/Ombi/ClientApp/src/app/calendar/components/calendar.component.ts create mode 100644 src/Ombi/ClientApp/src/app/calendar/components/index.ts create mode 100644 src/Ombi/ClientApp/src/app/interfaces/ICalendar.ts create mode 100644 src/Ombi/ClientApp/src/app/services/calendar.service.ts create mode 100644 src/Ombi/Controllers/V2/CallendarController.cs diff --git a/src/Ombi.Core/Engine/V2/CalendarEngine.cs b/src/Ombi.Core/Engine/V2/CalendarEngine.cs new file mode 100644 index 000000000..b3cc49084 --- /dev/null +++ b/src/Ombi.Core/Engine/V2/CalendarEngine.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Principal; +using System.Threading.Tasks; +using Ombi.Core.Authentication; +using Ombi.Core.Engine.Interfaces; +using Ombi.Core.Models.Search.V2; +using Ombi.Core.Rule.Interfaces; +using Ombi.Store.Repository.Requests; + +namespace Ombi.Core.Engine.V2 +{ + public class CalendarEngine : BaseEngine, ICalendarEngine + { + public CalendarEngine(IPrincipal user, OmbiUserManager um, IRuleEvaluator rules, IMovieRequestRepository movieRepo, + ITvRequestRepository tvRequestRepo) : base(user, um, rules) + { + _movieRepo = movieRepo; + _tvRepo = tvRequestRepo; + } + + private readonly IMovieRequestRepository _movieRepo; + private readonly ITvRequestRepository _tvRepo; + + public async Task> GetCalendarData() + { + var viewModel = new List(); + var movies = _movieRepo.GetAll().Where(x => + x.ReleaseDate > DateTime.Now.AddDays(-30) && x.ReleaseDate < DateTime.Now.AddDays(30)); + var episodes = _tvRepo.GetChild().SelectMany(x => x.SeasonRequests.SelectMany(e => e.Episodes)).ToList(); + foreach (var e in episodes) + { + viewModel.Add(new CalendarViewModel + { + Title = e.Title, + Start = e.AirDate.Date + }); + } + + foreach (var m in movies) + { + viewModel.Add(new CalendarViewModel + { + Title = m.Title, + Start = m.ReleaseDate.Date + }); + } + + return viewModel; + } + } +} \ No newline at end of file diff --git a/src/Ombi.Core/Engine/V2/ICalendarEngine.cs b/src/Ombi.Core/Engine/V2/ICalendarEngine.cs new file mode 100644 index 000000000..1a97d9227 --- /dev/null +++ b/src/Ombi.Core/Engine/V2/ICalendarEngine.cs @@ -0,0 +1,11 @@ +using Ombi.Core.Models.Search.V2; +using System.Threading.Tasks; +using System.Collections.Generic; + +namespace Ombi.Core.Engine.V2 +{ + public interface ICalendarEngine + { + Task> GetCalendarData(); + } +} \ No newline at end of file diff --git a/src/Ombi.Core/Models/Search/V2/CalendarViewModel.cs b/src/Ombi.Core/Models/Search/V2/CalendarViewModel.cs new file mode 100644 index 000000000..a4d5a3158 --- /dev/null +++ b/src/Ombi.Core/Models/Search/V2/CalendarViewModel.cs @@ -0,0 +1,10 @@ +using System; + +namespace Ombi.Core.Models.Search.V2 +{ + public class CalendarViewModel + { + public string Title { get; set; } + public DateTime Start { get; set; } + } +} \ No newline at end of file diff --git a/src/Ombi.DependencyInjection/IocExtensions.cs b/src/Ombi.DependencyInjection/IocExtensions.cs index 2698aed57..dd4d80f1c 100644 --- a/src/Ombi.DependencyInjection/IocExtensions.cs +++ b/src/Ombi.DependencyInjection/IocExtensions.cs @@ -103,6 +103,7 @@ namespace Ombi.DependencyInjection services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } public static void RegisterHttp(this IServiceCollection services) diff --git a/src/Ombi/ClientApp/angular.json b/src/Ombi/ClientApp/angular.json index 8dab70b61..ecad176c9 100644 --- a/src/Ombi/ClientApp/angular.json +++ b/src/Ombi/ClientApp/angular.json @@ -31,12 +31,14 @@ "node_modules/font-awesome/scss/font-awesome.scss", "node_modules/primeng/resources/primeng.min.css", "node_modules/primeng/resources/themes/nova-light/theme.css", - "node_modules/primeicons/primeicons.css" + "node_modules/primeicons/primeicons.css", + "node_modules/fullcalendar/dist/fullcalendar.min.css" ], "scripts": [ "node_modules/jquery/dist/jquery.min.js", "node_modules/chart.js/dist/Chart.js", - "node_modules/hammerjs/hammer.min.js" + "node_modules/hammerjs/hammer.min.js", + "node_modules/fullcalendar/dist/fullcalendar.min.js" ] }, "configurations": { diff --git a/src/Ombi/ClientApp/package.json b/src/Ombi/ClientApp/package.json index a59b7779c..b1f6a9c1b 100644 --- a/src/Ombi/ClientApp/package.json +++ b/src/Ombi/ClientApp/package.json @@ -40,6 +40,7 @@ "core-js": "^2.5.4", "eventemitter2": "^5.0.1", "font-awesome": "^4.7.0", + "fullcalendar": "4.0.0-alpha.2", "hammerjs": "^2.0.8", "jquery": "3.3.1", "moment": "^2.23.0", @@ -53,8 +54,8 @@ "ngx-page-scroll": "^5.0.1", "pace": "github:HubSpot/pace#v1.0.2", "popper.js": "^1.14.3", - "primeng": "^7.0.3", "primeicons": "^1.0.0", + "primeng": "^7.0.3", "rxjs": "^6.0.0", "socket.io-client": "^2.2.0", "store": "^2.0.12", diff --git a/src/Ombi/ClientApp/src/app/app.module.ts b/src/Ombi/ClientApp/src/app/app.module.ts index c13f00de7..819fb98e8 100644 --- a/src/Ombi/ClientApp/src/app/app.module.ts +++ b/src/Ombi/ClientApp/src/app/app.module.ts @@ -64,6 +64,7 @@ const routes: Routes = [ { path: "token", component: TokenResetPasswordComponent }, { path: "landingpage", component: LandingPageComponent }, { path: "auth/cookie", component: CookieComponent }, + { loadChildren: "./calendar/calendar.module#CalendarModule", path: "calendar" }, { loadChildren: "./discover/discover.module#DiscoverModule", path: "discover" }, { loadChildren: "./issues/issues.module#IssuesModule", path: "issues" }, { loadChildren: "./settings/settings.module#SettingsModule", path: "Settings" }, diff --git a/src/Ombi/ClientApp/src/app/calendar/calendar.module.ts b/src/Ombi/ClientApp/src/app/calendar/calendar.module.ts new file mode 100644 index 000000000..89cab9dd0 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/calendar/calendar.module.ts @@ -0,0 +1,39 @@ +import { NgModule } from "@angular/core"; +import { RouterModule, Routes } from "@angular/router"; + +import { RequestService } from "../services"; + +import { SharedModule } from "../shared/shared.module"; +import { PipeModule } from "../pipes/pipe.module"; + +import * as fromComponents from './components'; +import { AuthGuard } from "../auth/auth.guard"; +import { CalendarComponent } from "./components/calendar.component"; + +import { FullCalendarModule } from 'primeng/fullcalendar'; +import { CalendarService } from "../services/calendar.service"; + + +const routes: Routes = [ + { path: "", component: CalendarComponent, canActivate: [AuthGuard] }, +]; +@NgModule({ + imports: [ + RouterModule.forChild(routes), + SharedModule, + PipeModule, + FullCalendarModule, + ], + declarations: [ + ...fromComponents.components + ], + exports: [ + RouterModule, + ], + providers: [ + RequestService, + CalendarService + ], + +}) +export class CalendarModule { } diff --git a/src/Ombi/ClientApp/src/app/calendar/components/calendar.component.html b/src/Ombi/ClientApp/src/app/calendar/components/calendar.component.html new file mode 100644 index 000000000..47c6213db --- /dev/null +++ b/src/Ombi/ClientApp/src/app/calendar/components/calendar.component.html @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/calendar/components/calendar.component.scss b/src/Ombi/ClientApp/src/app/calendar/components/calendar.component.scss new file mode 100644 index 000000000..195b7ff32 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/calendar/components/calendar.component.scss @@ -0,0 +1,5 @@ + +.small-middle-container{ + margin: auto; + width: 80%; +} diff --git a/src/Ombi/ClientApp/src/app/calendar/components/calendar.component.ts b/src/Ombi/ClientApp/src/app/calendar/components/calendar.component.ts new file mode 100644 index 000000000..722a100f9 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/calendar/components/calendar.component.ts @@ -0,0 +1,66 @@ +import { Component, OnInit } from "@angular/core"; +import { CalendarService } from "../../services/calendar.service"; +import { ICalendarModel } from "../../interfaces/ICalendar"; + +@Component({ + templateUrl: "./calendar.component.html", + styleUrls: ["./calendar.component.scss"], +}) +export class CalendarComponent implements OnInit { + + public loadingFlag: boolean; + events: any[]; + options: any; + entries: ICalendarModel[]; + + constructor(private calendarService: CalendarService) { } + + public async ngOnInit() { + debugger; + this.loading() + this.entries = await this.calendarService.getCalendarEntries(); + this.events = [ + { + "title": "All Day Event", + "start": new Date(), + "eventColor":"black" + }, + { + "title": "Long Event", + "start": "2016-01-07", + "end": "2016-01-10" + }, + { + "title": "Repeating Event", + "start": "2016-01-09T16:00:00" + }, + { + "title": "Repeating Event", + "start": "2016-01-16T16:00:00" + }, + { + "title": "Conference", + "start": "2016-01-11", + "end": "2016-01-13" + } + ]; + + this.options = { + defaultDate: new Date(), + header: { + left: 'prev,next', + center: 'title', + right: 'month,agendaWeek' + }, + }; + this.finishLoading(); + } + + private loading() { + this.loadingFlag = true; + } + + private finishLoading() { + this.loadingFlag = false; + } +} diff --git a/src/Ombi/ClientApp/src/app/calendar/components/index.ts b/src/Ombi/ClientApp/src/app/calendar/components/index.ts new file mode 100644 index 000000000..74f27ba63 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/calendar/components/index.ts @@ -0,0 +1,5 @@ +import { CalendarComponent } from "./calendar.component"; + +export const components: any[] = [ + CalendarComponent, +]; diff --git a/src/Ombi/ClientApp/src/app/interfaces/ICalendar.ts b/src/Ombi/ClientApp/src/app/interfaces/ICalendar.ts new file mode 100644 index 000000000..0c81f1513 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/interfaces/ICalendar.ts @@ -0,0 +1,5 @@ +export interface ICalendarModel { + title: string; + startDate: Date; + endDate: Date; +} \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts index 8bcd67ef6..5ddfe3bef 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts @@ -38,6 +38,7 @@ export class MyNavComponent implements OnInit { { name: "NavigationBar.Discover", icon: "find_replace", link: "/discover", requiresAdmin: false }, { name: "NavigationBar.Requests", icon: "list", link: "/requests-list", requiresAdmin: false }, { name: "NavigationBar.UserManagement", icon: "account_circle", link: "/usermanagement", requiresAdmin: true }, + { name: "NavigationBar.Calendar", icon: "calendar", link: "/calendar", requiresAdmin: false }, { name: "NavigationBar.Settings", icon: "settings", link: "/Settings/About", requiresAdmin: true }, ] diff --git a/src/Ombi/ClientApp/src/app/services/calendar.service.ts b/src/Ombi/ClientApp/src/app/services/calendar.service.ts new file mode 100644 index 000000000..ba54d0048 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/services/calendar.service.ts @@ -0,0 +1,18 @@ +import { PlatformLocation, APP_BASE_HREF } from "@angular/common"; +import { Injectable, Inject } from "@angular/core"; + +import { HttpClient } from "@angular/common/http"; +import { Observable } from "rxjs"; + +import { ServiceHelpers } from "./service.helpers"; +import { ICalendarModel } from "../interfaces/ICalendar"; + +@Injectable() +export class CalendarService extends ServiceHelpers { + constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) { + super(http, "/api/v2/Calendar/", href); + } + public getCalendarEntries(): Promise { + return this.http.get(`${this.url}`, {headers: this.headers}).toPromise(); + } +} diff --git a/src/Ombi/ClientApp/src/app/shared/functions/common-functions.ts b/src/Ombi/ClientApp/src/app/shared/functions/common-functions.ts index c3f88fc3a..8d94d8dc0 100644 --- a/src/Ombi/ClientApp/src/app/shared/functions/common-functions.ts +++ b/src/Ombi/ClientApp/src/app/shared/functions/common-functions.ts @@ -23,5 +23,6 @@ const invalidProxies: string[] = [ 'RESET', 'CUSTOM', 'AUTH', - 'WIZARD' + 'WIZARD', + "CALENDAR" ] \ No newline at end of file diff --git a/src/Ombi/ClientApp/yarn.lock b/src/Ombi/ClientApp/yarn.lock index dbb8d0330..91b11cbd4 100644 --- a/src/Ombi/ClientApp/yarn.lock +++ b/src/Ombi/ClientApp/yarn.lock @@ -1425,7 +1425,7 @@ component-bind@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/component-bind/-/component-bind-1.0.0.tgz#00c608ab7dcd93897c0009651b1d3a8e1e73bbd1" -component-emitter@1.2.1, component-emitter@^1.2.1: +component-emitter@1.2.1, component-emitter@^1.2.0, component-emitter@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" @@ -1504,6 +1504,11 @@ cookie@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" +cookiejar@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.2.tgz#dd8a235530752f988f9a0844f3fc589e3111125c" + integrity sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA== + copy-concurrently@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" @@ -2207,7 +2212,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@~3.0.2: +extend@^3.0.0, extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" @@ -2414,7 +2419,7 @@ forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" -form-data@~2.3.2: +form-data@^2.3.1, form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" dependencies: @@ -2422,6 +2427,11 @@ form-data@~2.3.2: combined-stream "^1.0.6" mime-types "^2.1.12" +formidable@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.2.1.tgz#70fb7ca0290ee6ff961090415f4b3df3d2082659" + integrity sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg== + forwarded@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" @@ -2478,6 +2488,17 @@ fstream@^1.0.0, fstream@^1.0.2: mkdirp ">=0.5 0" rimraf "2" +fullcalendar@4.0.0-alpha.2: + version "4.0.0-alpha.2" + resolved "https://registry.yarnpkg.com/fullcalendar/-/fullcalendar-4.0.0-alpha.2.tgz#af5219bd955ee3c3549a39777808dd1dda645111" + integrity sha512-2trFzbvQWHijyt+u8Zv98PPfDkFH5bU5Yoqvn2ot5PTwIkLK95xrNat5jTHfpBMwh+KqHQSnux/BcGXARYgwcw== + dependencies: + luxon "^1.4.2" + moment "^2.22.2" + moment-timezone "^0.5.21" + rrule "^2.5.6" + superagent "^3.8.3" + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -3599,6 +3620,11 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" +luxon@^1.3.3, luxon@^1.4.2: + version "1.12.0" + resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.12.0.tgz#d02d53c8d8aaebe6b4c00ba1ce1be3913546b2e7" + integrity sha512-enPnPIHd5ZnZT0vpj9Xv8aq4j0yueAkhnh4xUKUHpqlgSm1r/8s6xTMjfyp2ugOWP7zivqJqgVTkW+rpHed61w== + magic-string@^0.25.0: version "0.25.1" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.1.tgz#b1c248b399cd7485da0fe7385c2fc7011843266e" @@ -3707,7 +3733,7 @@ merge-descriptors@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" -methods@~1.1.2: +methods@^1.1.1, methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -3877,7 +3903,14 @@ mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: dependencies: minimist "0.0.8" -moment@^2.10.6, moment@^2.23.0: +moment-timezone@^0.5.21: + version "0.5.23" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.23.tgz#7cbb00db2c14c71b19303cb47b0fb0a6d8651463" + integrity sha512-WHFH85DkCfiNMDX5D3X7hpNH3/PUhjTGcD0U1SgfBGZxJ3qUmJh5FdvaFjcClxOvB3rzdfj4oRffbI38jEnC1w== + dependencies: + moment ">= 2.9.0" + +"moment@>= 2.9.0", moment@^2.10.6, moment@^2.22.2, moment@^2.23.0: version "2.24.0" resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" @@ -4889,6 +4922,11 @@ qs@6.5.2, qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" +qs@^6.5.1: + version "6.7.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" + integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== + querystring-es3@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" @@ -4984,7 +5022,7 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6: +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" dependencies: @@ -5186,6 +5224,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +rrule@^2.5.6: + version "2.6.0" + resolved "https://registry.yarnpkg.com/rrule/-/rrule-2.6.0.tgz#7aeefe89273e4796d1fabf03051d5e1d68169502" + integrity sha512-TRigkTJtG7Y1yOjNSKvFvVmvj/PzRZLR8lLcPW9GASOlaoqoL1J0kNuUV9I3LuZc7qFT+QB2NbxSLL9d33/ylg== + optionalDependencies: + luxon "^1.3.3" + run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" @@ -5861,6 +5906,22 @@ stylus@0.54.5: sax "0.5.x" source-map "0.1.x" +superagent@^3.8.3: + version "3.8.3" + resolved "https://registry.yarnpkg.com/superagent/-/superagent-3.8.3.tgz#460ea0dbdb7d5b11bc4f78deba565f86a178e128" + integrity sha512-GLQtLMCoEIK4eDv6OGtkOoSMt3D+oq0y3dsxMuYuDvaNUvuT8eFBuLmfR0iYYzHC1e8hpzC6ZsxbuP6DIalMFA== + dependencies: + component-emitter "^1.2.0" + cookiejar "^2.1.0" + debug "^3.1.0" + extend "^3.0.0" + form-data "^2.3.1" + formidable "^1.2.0" + methods "^1.1.1" + mime "^1.4.1" + qs "^6.5.1" + readable-stream "^2.3.5" + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" diff --git a/src/Ombi/Controllers/V2/CallendarController.cs b/src/Ombi/Controllers/V2/CallendarController.cs new file mode 100644 index 000000000..b07f06617 --- /dev/null +++ b/src/Ombi/Controllers/V2/CallendarController.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +using System.Threading.Tasks; + +using Ombi.Core.Engine.V2; +using Ombi.Core.Models.Search.V2; + +namespace Ombi.Controllers.V2 +{ + [ApiV2] + [Authorize] + [ApiController] + public class CalendarController : ControllerBase + { + public CalendarController(ICalendarEngine calendarEngine) + { + _calendarEngine = calendarEngine; + } + + private readonly ICalendarEngine _calendarEngine; + + + [HttpGet] + public async Task> GetCalendarEntried() + { + return await _calendarEngine.GetCalendarData(); + } + } +} \ No newline at end of file diff --git a/src/Ombi/wwwroot/translations/en.json b/src/Ombi/wwwroot/translations/en.json index 63facda83..58ed985f3 100644 --- a/src/Ombi/wwwroot/translations/en.json +++ b/src/Ombi/wwwroot/translations/en.json @@ -61,7 +61,8 @@ "Logout": "Logout", "OpenMobileApp": "Open Mobile App", "RecentlyAdded": "Recently Added", - "ChangeTheme":"Change Theme" + "ChangeTheme":"Change Theme", + "Calendar":"Calendar" }, "Search": { "Title": "Search",