Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-export unchanged datastore classes instead of wrapping them #6456

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 4 additions & 142 deletions src/datastores/handlers/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,146 +20,8 @@ class Settings {
}
}

class History {
static find() {
return baseHandlers.history.find()
}

static upsert(record) {
return baseHandlers.history.upsert(record)
}

static overwrite(records) {
return baseHandlers.history.overwrite(records)
}

static updateWatchProgress(videoId, watchProgress) {
return baseHandlers.history.updateWatchProgress(videoId, watchProgress)
}

static updateLastViewedPlaylist(videoId, lastViewedPlaylistId, lastViewedPlaylistType, lastViewedPlaylistItemId) {
return baseHandlers.history.updateLastViewedPlaylist(videoId, lastViewedPlaylistId, lastViewedPlaylistType, lastViewedPlaylistItemId)
}

static delete(videoId) {
return baseHandlers.history.delete(videoId)
}

static deleteAll() {
return baseHandlers.history.deleteAll()
}
}

class Profiles {
static create(profile) {
return baseHandlers.profiles.create(profile)
}

static find() {
return baseHandlers.profiles.find()
}

static upsert(profile) {
return baseHandlers.profiles.upsert(profile)
}

static addChannelToProfiles(channel, profileIds) {
return baseHandlers.profiles.addChannelToProfiles(channel, profileIds)
}

static removeChannelFromProfiles(channelId, profileIds) {
return baseHandlers.profiles.removeChannelFromProfiles(channelId, profileIds)
}

static delete(id) {
return baseHandlers.profiles.delete(id)
}
}

class Playlists {
static create(playlists) {
return baseHandlers.playlists.create(playlists)
}

static find() {
return baseHandlers.playlists.find()
}

static upsert(playlist) {
return baseHandlers.playlists.upsert(playlist)
}
// For the settings we use the wrapper class to hide some methods only needed in the Electron main process
export { Settings as settings }

static upsertVideoByPlaylistId(_id, videoData) {
return baseHandlers.playlists.upsertVideoByPlaylistId(_id, videoData)
}

static upsertVideosByPlaylistId(_id, videoData) {
return baseHandlers.playlists.upsertVideosByPlaylistId(_id, videoData)
}

static delete(_id) {
return baseHandlers.playlists.delete(_id)
}

static deleteVideoIdByPlaylistId(_id, videoId, playlistItemId) {
return baseHandlers.playlists.deleteVideoIdByPlaylistId(_id, videoId, playlistItemId)
}

static deleteVideoIdsByPlaylistId(_id, videoIds) {
return baseHandlers.playlists.deleteVideoIdsByPlaylistId(_id, videoIds)
}

static deleteAllVideosByPlaylistId(_id) {
return baseHandlers.playlists.deleteAllVideosByPlaylistId(_id)
}

static deleteMultiple(ids) {
return baseHandlers.playlists.deleteMultiple(ids)
}

static deleteAll() {
return baseHandlers.playlists.deleteAll()
}
}

class SubscriptionCache {
static find() {
return baseHandlers.subscriptionCache.find()
}

static updateVideosByChannelId(channelId, entries, timestamp) {
return baseHandlers.subscriptionCache.updateVideosByChannelId(channelId, entries, timestamp)
}

static updateLiveStreamsByChannelId(channelId, entries, timestamp) {
return baseHandlers.subscriptionCache.updateLiveStreamsByChannelId(channelId, entries, timestamp)
}

static updateShortsByChannelId(channelId, entries, timestamp) {
return baseHandlers.subscriptionCache.updateShortsByChannelId(channelId, entries, timestamp)
}

static updateShortsWithChannelPageShortsByChannelId(channelId, entries) {
return baseHandlers.subscriptionCache.updateShortsWithChannelPageShortsByChannelId(channelId, entries)
}

static updateCommunityPostsByChannelId(channelId, entries, timestamp) {
return baseHandlers.subscriptionCache.updateCommunityPostsByChannelId(channelId, entries, timestamp)
}

static deleteMultipleChannels(channelIds) {
return baseHandlers.subscriptionCache.deleteMultipleChannels(channelIds)
}

static deleteAll() {
return baseHandlers.subscriptionCache.deleteAll()
}
}

export {
Settings as settings,
History as history,
Profiles as profiles,
Playlists as playlists,
SubscriptionCache as subscriptionCache,
}
// These classes don't require any changes from the base classes, so can be exported as-is.
export { history, profiles, playlists, subscriptionCache } from './base'
Loading