232 lines
8.6 KiB
TypeScript
232 lines
8.6 KiB
TypeScript
import { UserProfile, PostMediaItem } from '../pages/Post/types';
|
|
import { MediaType, MediaItem } from '../types';
|
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
export declare const fetchPostById: (id: string, client?: SupabaseClient) => Promise<{
|
|
created_at: string | null;
|
|
description: string | null;
|
|
id: string;
|
|
meta: import('../integrations/supabase/types').Json | null;
|
|
settings: import('../integrations/supabase/types').Json | null;
|
|
title: string;
|
|
updated_at: string | null;
|
|
user_id: string;
|
|
pictures: {
|
|
created_at: string;
|
|
description: string | null;
|
|
flags: string[] | null;
|
|
id: string;
|
|
image_url: string;
|
|
is_selected: boolean;
|
|
likes_count: number | null;
|
|
meta: import('../integrations/supabase/types').Json | null;
|
|
organization_id: string | null;
|
|
parent_id: string | null;
|
|
position: number | null;
|
|
post_id: string | null;
|
|
tags: string[] | null;
|
|
thumbnail_url: string | null;
|
|
title: string;
|
|
type: string | null;
|
|
updated_at: string;
|
|
user_id: string;
|
|
visible: boolean;
|
|
}[];
|
|
}>;
|
|
export declare const fetchPictureById: (id: string, client?: SupabaseClient) => Promise<{
|
|
created_at: string;
|
|
description: string | null;
|
|
flags: string[] | null;
|
|
id: string;
|
|
image_url: string;
|
|
is_selected: boolean;
|
|
likes_count: number | null;
|
|
meta: import('../integrations/supabase/types').Json | null;
|
|
organization_id: string | null;
|
|
parent_id: string | null;
|
|
position: number | null;
|
|
post_id: string | null;
|
|
tags: string[] | null;
|
|
thumbnail_url: string | null;
|
|
title: string;
|
|
type: string | null;
|
|
updated_at: string;
|
|
user_id: string;
|
|
visible: boolean;
|
|
post: {
|
|
created_at: string | null;
|
|
description: string | null;
|
|
id: string;
|
|
meta: import('../integrations/supabase/types').Json | null;
|
|
settings: import('../integrations/supabase/types').Json | null;
|
|
title: string;
|
|
updated_at: string | null;
|
|
user_id: string;
|
|
};
|
|
}>;
|
|
export declare const fetchPageById: (id: string, client?: SupabaseClient) => Promise<{
|
|
content: import('../integrations/supabase/types').Json | null;
|
|
created_at: string;
|
|
id: string;
|
|
is_public: boolean;
|
|
owner: string;
|
|
parent: string | null;
|
|
slug: string;
|
|
tags: string[] | null;
|
|
title: string;
|
|
type: string | null;
|
|
updated_at: string;
|
|
visible: boolean;
|
|
}>;
|
|
export declare const fetchFullPost: (postId: string, client?: SupabaseClient) => Promise<{
|
|
created_at: string | null;
|
|
description: string | null;
|
|
id: string;
|
|
meta: import('../integrations/supabase/types').Json | null;
|
|
settings: import('../integrations/supabase/types').Json | null;
|
|
title: string;
|
|
updated_at: string | null;
|
|
user_id: string;
|
|
pictures: {
|
|
created_at: string;
|
|
description: string | null;
|
|
flags: string[] | null;
|
|
id: string;
|
|
image_url: string;
|
|
is_selected: boolean;
|
|
likes_count: number | null;
|
|
meta: import('../integrations/supabase/types').Json | null;
|
|
organization_id: string | null;
|
|
parent_id: string | null;
|
|
position: number | null;
|
|
post_id: string | null;
|
|
tags: string[] | null;
|
|
thumbnail_url: string | null;
|
|
title: string;
|
|
type: string | null;
|
|
updated_at: string;
|
|
user_id: string;
|
|
visible: boolean;
|
|
}[];
|
|
}>;
|
|
export declare const fetchAuthorProfile: (userId: string, client?: SupabaseClient) => Promise<UserProfile | null>;
|
|
export declare const fetchVersions: (mediaItem: PostMediaItem, userId?: string, client?: SupabaseClient) => Promise<{
|
|
created_at: string;
|
|
description: string | null;
|
|
flags: string[] | null;
|
|
id: string;
|
|
image_url: string;
|
|
is_selected: boolean;
|
|
likes_count: number | null;
|
|
meta: import('../integrations/supabase/types').Json | null;
|
|
organization_id: string | null;
|
|
parent_id: string | null;
|
|
position: number | null;
|
|
post_id: string | null;
|
|
tags: string[] | null;
|
|
thumbnail_url: string | null;
|
|
title: string;
|
|
type: string | null;
|
|
updated_at: string;
|
|
user_id: string;
|
|
visible: boolean;
|
|
}[]>;
|
|
export declare const checkLikeStatus: (userId: string, pictureId: string, client?: SupabaseClient) => Promise<boolean>;
|
|
export declare const toggleLike: (userId: string, pictureId: string, isLiked: boolean, client?: SupabaseClient) => Promise<boolean>;
|
|
export declare const uploadFileToStorage: (userId: string, file: File | Blob, fileName?: string, client?: SupabaseClient) => Promise<string>;
|
|
export declare const createPicture: (picture: Partial<PostMediaItem>, client?: SupabaseClient) => Promise<{
|
|
created_at: string;
|
|
description: string | null;
|
|
flags: string[] | null;
|
|
id: string;
|
|
image_url: string;
|
|
is_selected: boolean;
|
|
likes_count: number | null;
|
|
meta: import('../integrations/supabase/types').Json | null;
|
|
organization_id: string | null;
|
|
parent_id: string | null;
|
|
position: number | null;
|
|
post_id: string | null;
|
|
tags: string[] | null;
|
|
thumbnail_url: string | null;
|
|
title: string;
|
|
type: string | null;
|
|
updated_at: string;
|
|
user_id: string;
|
|
visible: boolean;
|
|
}>;
|
|
export declare const updatePostDetails: (postId: string, updates: {
|
|
title: string;
|
|
description: string;
|
|
}, client?: SupabaseClient) => Promise<void>;
|
|
export declare const unlinkPictures: (ids: string[], client?: SupabaseClient) => Promise<void>;
|
|
export declare const upsertPictures: (pictures: Partial<PostMediaItem>[], client?: SupabaseClient) => Promise<void>;
|
|
export declare const getUserSettings: (userId: string, client?: SupabaseClient) => Promise<any>;
|
|
export declare const updateUserSettings: (userId: string, settings: any, client?: SupabaseClient) => Promise<void>;
|
|
export declare const getUserOpenAIKey: (userId: string, client?: SupabaseClient) => Promise<any>;
|
|
export declare const addCollectionPictures: (inserts: {
|
|
collection_id: string;
|
|
picture_id: string;
|
|
}[], client?: SupabaseClient) => Promise<void>;
|
|
export declare const updateStorageFile: (path: string, blob: Blob, client?: SupabaseClient) => Promise<void>;
|
|
export declare const fetchSelectedVersions: (rootIds: string[], client?: SupabaseClient) => Promise<{
|
|
created_at: string;
|
|
description: string | null;
|
|
flags: string[] | null;
|
|
id: string;
|
|
image_url: string;
|
|
is_selected: boolean;
|
|
likes_count: number | null;
|
|
meta: import('../integrations/supabase/types').Json | null;
|
|
organization_id: string | null;
|
|
parent_id: string | null;
|
|
position: number | null;
|
|
post_id: string | null;
|
|
tags: string[] | null;
|
|
thumbnail_url: string | null;
|
|
title: string;
|
|
type: string | null;
|
|
updated_at: string;
|
|
user_id: string;
|
|
visible: boolean;
|
|
}[]>;
|
|
export declare const fetchRelatedVersions: (rootIds: string[], client?: SupabaseClient) => Promise<{
|
|
created_at: string;
|
|
description: string | null;
|
|
flags: string[] | null;
|
|
id: string;
|
|
image_url: string;
|
|
is_selected: boolean;
|
|
likes_count: number | null;
|
|
meta: import('../integrations/supabase/types').Json | null;
|
|
organization_id: string | null;
|
|
parent_id: string | null;
|
|
position: number | null;
|
|
post_id: string | null;
|
|
tags: string[] | null;
|
|
thumbnail_url: string | null;
|
|
title: string;
|
|
type: string | null;
|
|
updated_at: string;
|
|
user_id: string;
|
|
visible: boolean;
|
|
}[]>;
|
|
export declare const fetchUserRoles: (userId: string, client?: SupabaseClient) => Promise<("viewer" | "owner" | "admin" | "member")[]>;
|
|
export declare const fetchUserLikesForPictures: (userId: string, pictureIds: string[], client?: SupabaseClient) => Promise<string[]>;
|
|
export interface FeedPost {
|
|
id: string;
|
|
title: string;
|
|
description: string | null;
|
|
created_at: string;
|
|
user_id: string;
|
|
pictures: MediaItem[];
|
|
cover: MediaItem;
|
|
likes_count: number;
|
|
comments_count: number;
|
|
type: MediaType;
|
|
author_profile?: UserProfile;
|
|
}
|
|
export declare const fetchFeedPosts: (source?: "home" | "collection" | "tag" | "user", sourceId?: string, isOrgContext?: boolean, orgSlug?: string, client?: SupabaseClient) => Promise<FeedPost[]>;
|
|
export declare const fetchFeedPostsPaginated: (source?: "home" | "collection" | "tag" | "user", sourceId?: string, isOrgContext?: boolean, orgSlug?: string, page?: number, pageSize?: number, client?: SupabaseClient) => Promise<FeedPost[]>;
|
|
export declare const mapFeedPostsToMediaItems: (posts: FeedPost[], sortBy?: "latest" | "top") => any[];
|
|
export declare const augmentFeedPosts: (posts: any[]) => FeedPost[];
|