Add Watch Buddies feature
- Created WatchBuddy model - M:N junctions to EntrySeen/EpisodeSeen and Media relation for profile pictures - Full CRUD + search + profile picture upload - WatchBuddySelect multi-select with search and inline create, replaced all seen_with text inputs - WatchBuddiesPage (grid) and WatchBuddyProfilePage (edit form, icon-based contacts, poster-grid watch history, monthly timeline)
This commit is contained in:
1 parent
4313a794ce
commit
e82b905886
28 files changed
+6813
-374
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { api } from '@/lib/api';
|
||||
import { api } from "@/lib/api";
|
||||
|
||||
export interface OrphanResult {
|
||||
posters: number;
|
||||
@@ -13,39 +13,39 @@ export interface OrphanPeopleResult {
|
||||
|
||||
export const maintenanceApi = {
|
||||
scanOrphanFiles: () =>
|
||||
api.get<OrphanResult>('/maintenance/orphan-files').then((r) => r.data),
|
||||
api.get<OrphanResult>("/maintenance/orphan-files").then((r) => r.data),
|
||||
|
||||
deleteOrphanFiles: () =>
|
||||
api.delete<OrphanResult>('/maintenance/orphan-files').then((r) => r.data),
|
||||
api.delete<OrphanResult>("/maintenance/orphan-files").then((r) => r.data),
|
||||
|
||||
scanOrphanMediaRecords: () =>
|
||||
api
|
||||
.get<OrphanResult>('/maintenance/orphan-media-records')
|
||||
.get<OrphanResult>("/maintenance/orphan-media-records")
|
||||
.then((r) => r.data),
|
||||
|
||||
deleteOrphanMediaRecords: () =>
|
||||
api
|
||||
.delete<OrphanResult>('/maintenance/orphan-media-records')
|
||||
.delete<OrphanResult>("/maintenance/orphan-media-records")
|
||||
.then((r) => r.data),
|
||||
|
||||
scanOrphanPeople: () =>
|
||||
api
|
||||
.get<OrphanPeopleResult>('/maintenance/orphan-people')
|
||||
.get<OrphanPeopleResult>("/maintenance/orphan-people")
|
||||
.then((r) => r.data),
|
||||
|
||||
deleteOrphanPeople: () =>
|
||||
api
|
||||
.delete<OrphanPeopleResult>('/maintenance/orphan-people')
|
||||
.delete<OrphanPeopleResult>("/maintenance/orphan-people")
|
||||
.then((r) => r.data),
|
||||
|
||||
scanMissingDirectors: () =>
|
||||
api
|
||||
.get<{ count: number; fixed: number }>('/maintenance/missing-directors')
|
||||
.get<{ count: number; fixed: number }>("/maintenance/missing-directors")
|
||||
.then((r) => r.data),
|
||||
|
||||
fixMissingDirectors: () =>
|
||||
api
|
||||
.post<{ count: number; fixed: number }>('/maintenance/missing-directors')
|
||||
.post<{ count: number; fixed: number }>("/maintenance/missing-directors")
|
||||
.then((r) => r.data),
|
||||
|
||||
scanDuplicateCredits: () =>
|
||||
@@ -54,7 +54,7 @@ export const maintenanceApi = {
|
||||
groups: number;
|
||||
duplicates: number;
|
||||
deleted: number;
|
||||
}>('/maintenance/duplicate-credits')
|
||||
}>("/maintenance/duplicate-credits")
|
||||
.then((r) => r.data),
|
||||
|
||||
cleanDuplicateCredits: () =>
|
||||
@@ -63,7 +63,7 @@ export const maintenanceApi = {
|
||||
groups: number;
|
||||
duplicates: number;
|
||||
deleted: number;
|
||||
}>('/maintenance/duplicate-credits')
|
||||
}>("/maintenance/duplicate-credits")
|
||||
.then((r) => r.data),
|
||||
|
||||
autoFixWatchStatuses: () =>
|
||||
@@ -72,6 +72,6 @@ export const maintenanceApi = {
|
||||
completed: number;
|
||||
watching: number;
|
||||
planToWatch: number;
|
||||
}>('/maintenance/auto-fix-watch-statuses')
|
||||
}>("/maintenance/auto-fix-watch-statuses")
|
||||
.then((r) => r.data),
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
import { api } from "@/lib/api";
|
||||
import type { WatchBuddy } from "@/types";
|
||||
|
||||
export const watchBuddyApi = {
|
||||
search: (q?: string) =>
|
||||
api
|
||||
.get<WatchBuddy[]>("/watch-buddies/search", { params: { q } })
|
||||
.then((r) => r.data),
|
||||
|
||||
getById: (id: number) =>
|
||||
api.get<WatchBuddy>(`/watch-buddies/${id}`).then((r) => r.data),
|
||||
|
||||
getHistory: (id: number) =>
|
||||
api.get<any>(`/watch-buddies/${id}/history`).then((r) => r.data),
|
||||
|
||||
create: (data: Partial<WatchBuddy>) =>
|
||||
api.post<WatchBuddy>("/watch-buddies", data).then((r) => r.data),
|
||||
|
||||
update: (id: number, data: Partial<WatchBuddy>) =>
|
||||
api.put<WatchBuddy>(`/watch-buddies/${id}`, data).then((r) => r.data),
|
||||
|
||||
remove: (id: number) =>
|
||||
api.delete(`/watch-buddies/${id}`).then((r) => r.data),
|
||||
|
||||
uploadProfilePicture: (id: number, file: File) => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
return api
|
||||
.post(`/watch-buddies/${id}/profile-picture`, formData, {
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
})
|
||||
.then((r) => r.data);
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user