Store manga ID with subscriptions

This commit is contained in:
Alex Ling 2021-11-20 11:08:36 +00:00
parent 5442d124af
commit fe6f884d94
3 changed files with 7 additions and 2 deletions

View File

@ -5,6 +5,7 @@ const component = () => {
pid: undefined,
chapters: undefined, // undefined: not searched yet, []: empty
manga: undefined, // undefined: not searched yet, []: empty
mid: undefined, // id of the selected manga
allChapters: [],
query: "",
mangaTitle: "",
@ -374,6 +375,7 @@ const component = () => {
},
mangaSelected(event) {
const mid = event.currentTarget.getAttribute("data-id");
this.mid = mid;
this.searchChapters(mid);
},
subscribe(modal) {
@ -384,6 +386,7 @@ const component = () => {
filters: this.filterSettings,
plugin: this.pid,
name: this.subscriptionName.trim(),
manga: this.mid,
}),
headers: {
"Content-Type": "application/json",

View File

@ -54,12 +54,13 @@ struct Subscription
property id : String
property plugin_id : String
property manga_id : String
property name : String
property created_at : Int64
property last_checked : Int64
property filters = [] of Filter
def initialize(@plugin_id, @name)
def initialize(@plugin_id, @manga_id, @name)
@id = UUID.random.to_s
@created_at = Time.utc.to_unix
@last_checked = Time.utc.to_unix

View File

@ -629,12 +629,13 @@ struct APIRouter
post "/api/admin/plugin/subscriptions" do |env|
begin
plugin_id = env.params.json["plugin"].as String
manga_id = env.params.json["manga"].as String
filters = env.params.json["filters"].as(Array(JSON::Any)).map do |f|
Filter.from_json f.to_json
end
name = env.params.json["name"].as String
sub = Subscription.new plugin_id, name
sub = Subscription.new plugin_id, manga_id, name
sub.filters = filters
plugin = Plugin.new plugin_id