mirror of
https://github.com/anultravioletaurora/Jellify.git
synced 2026-05-07 14:09:40 -05:00
Figuring this out
Organizing backend, moving models out since it'll be used by components
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
|
||||
|
||||
export class ArtistModel {
|
||||
|
||||
name?: string | undefined | null;
|
||||
|
||||
constructor(itemDto : BaseItemDto) {
|
||||
|
||||
this.name = itemDto.Name
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
import { BaseItemDto } from '@jellyfin/sdk/lib/generated-client/models/base-item-dto'
|
||||
import { useQuery, UseQueryResult } from '@tanstack/react-query'
|
||||
import { JellyfinService } from '../jellyfinservice'
|
||||
import { ArtistModel } from '../models/ArtistModel'
|
||||
import { JellyfinService } from '../services/jellyfin-service'
|
||||
import { ArtistModel } from '../../models/ArtistModel'
|
||||
|
||||
namespace ArtistQueries {
|
||||
|
||||
export function fetchArtistById(artistJellyfinId: string) : UseQueryResult<ArtistModel> {
|
||||
return useQuery({
|
||||
queryKey: ['artists', artistJellyfinId],
|
||||
queryFn: async () => {
|
||||
return JellyfinService.instance.getArtistById(artistJellyfinId);
|
||||
}
|
||||
queryFn: ({ queryKey }) => JellyfinService.instance.getArtistById(queryKey[1])
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
namespace ImageQueries {
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Api, Jellyfin } from "@jellyfin/sdk";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api"
|
||||
import { getDeviceNameSync, getUniqueIdSync } from "react-native-device-info";
|
||||
import { ArtistModel } from "./models/ArtistModel";
|
||||
import { ArtistModel } from "../../models/ArtistModel";
|
||||
import * as Keychain from "react-native-keychain"
|
||||
|
||||
let clientName : string = require('root-require')('./package.json').name
|
||||
@@ -33,6 +33,10 @@ export class JellyfinService {
|
||||
return this._instance || (this._instance = new this())
|
||||
}
|
||||
|
||||
public static get api() : Api {
|
||||
return this.instance.api!
|
||||
}
|
||||
|
||||
public initConnection(serverUrl: string) : void {
|
||||
JellyfinService.instance.api = JellyfinService.instance.client.createApi(serverUrl);
|
||||
}
|
||||
Reference in New Issue
Block a user