better-buddy-share-backend
    Preparing search index...
    interface IStreamsDAO {
        addPathToStream(streamId: number, path: string): Promise<Stream | null>;
        checkIfUserIsStreamer(userId: number): Promise<boolean | null>;
        checkIfUserIsStreaming(streamerId: number): Promise<boolean>;
        checkIfUserIsStreamingAndPublic(streamerId: number): Promise<boolean>;
        createStream(
            streamerId: number,
            title?: string | null,
            description?: string | null,
        ): Promise<Stream | null>;
        endAllStreams(): Promise<Stream[]>;
        endAllStreamsForUser(userId: number): Promise<Stream[]>;
        endStream(streamId: number): Promise<Stream | null>;
        getActiveStreams(): Promise<Stream[]>;
        getStreamById(streamId: number): Promise<Stream | null>;
        getStreamsByUserId(userId: number): Promise<Stream[]>;
        setStreamLiveStatus(
            streamId: number,
            isLive: boolean,
        ): Promise<Stream | null>;
        setStreamLockStatus(
            streamId: number,
            isLocked: boolean,
        ): Promise<Stream | null>;
        updateStreamDetails(
            streamId: number,
            title?: string | null,
            description?: string | null,
            thumbnail?: string | null,
        ): Promise<Stream | null>;
    }

    Implemented by

    Index

    Methods

    • Adds or updates the path for a stream (add_path_to_stream).

      Parameters

      • streamId: number

        The ID of the stream to update.

      • path: string

        The new path to associate with the stream.

      Returns Promise<Stream | null>

      A promise that resolves to the updated stream record or null if not found.

    • Checks if the user has a stream token set (Check_if_user_is_streamer).

      Parameters

      • userId: number

        The ID of the user to check.

      Returns Promise<boolean | null>

      A promise that resolves to a boolean indicating whether the user is a streamer.

    • Checks if the user is currently streaming (check_if_user_is_streaming).

      Parameters

      • streamerId: number

        The ID of the streamer to check.

      Returns Promise<boolean>

      A promise that resolves to a boolean indicating whether the user is currently streaming.

    • Checks if the user is streaming and the stream is public (check_if_user_is_streaming_and_public).

      Parameters

      • streamerId: number

        The ID of the streamer to check.

      Returns Promise<boolean>

      A promise that resolves to a boolean indicating whether the user is streaming and the stream is public.

    • Creates a new stream (create_stream) and returns the created record.

      Parameters

      • streamerId: number

        The ID of the streamer who will create the stream.

      • Optionaltitle: string | null

        The title of the stream (optional).

      • Optionaldescription: string | null

        The description of the stream (optional).

      Returns Promise<Stream | null>

      A promise that resolves to the created stream record.

    • Ends all active streams for a user (end_all_streams_for_user) and returns the updated records.

      Parameters

      • userId: number

        The ID of the user whose streams should be ended.

      Returns Promise<Stream[]>

      A promise that resolves to an array of the updated streams.

    • Ends a stream by its ID (end_stream) and returns the updated record or null.

      Parameters

      • streamId: number

        The ID of the stream to end.

      Returns Promise<Stream | null>

      A promise that resolves to the updated stream record or null if not found.

    • Retrieves all streams of a user (get_streams_by_user_id).

      Parameters

      • userId: number

        The ID of the user whose streams are to be retrieved.

      Returns Promise<Stream[]>

      A promise that resolves to an array of streams associated with the user.

    • Sets the live status for a stream (set_stream_live_status).

      Parameters

      • streamId: number

        The ID of the stream to update.

      • isLive: boolean

        The new live status of the stream (true for live, false for not live).

      Returns Promise<Stream | null>

      A promise that resolves to the updated stream record or null if not found.

    • Sets the lock status for a stream (set_stream_lock_status).

      Parameters

      • streamId: number

        The ID of the stream to update.

      • isLocked: boolean

        The new lock status of the stream (true to lock, false to unlock).

      Returns Promise<Stream | null>

      A promise that resolves to the updated stream record or null if not found.

    • Updates the details of a stream (update_stream_details).

      Parameters

      • streamId: number

        The ID of the stream to update.

      • Optionaltitle: string | null

        The new title of the stream (optional).

      • Optionaldescription: string | null

        The new description of the stream (optional).

      • Optionalthumbnail: string | null

        The new thumbnail URL for the stream (optional).

      Returns Promise<Stream | null>

      A promise that resolves to the updated stream record or null if not found.