Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PostVoteService

Post vote services

Hierarchy

Constructors

constructor

Properties

Readonly dbm

dbm: default

Methods

deletePostVotes

  • deletePostVotes(postID: string): Promise<void>
  • Delete all of a post's votes.

    Parameters

    • postID: string

      A post's ID.

    Returns Promise<void>

deleteUserVotes

  • deleteUserVotes(userID: string): Promise<void>
  • Delete all of a user's votes.

    Parameters

    • userID: string

      A user's ID.

    Returns Promise<void>

getNumPostVotes

  • getNumPostVotes(postID: string, voteType: string): Promise<number>
  • Get the number of votes a post has of a given vote type.

    Parameters

    • postID: string

      A post's ID.

    • voteType: string

      The type of vote.

    Returns Promise<number>

    The number of votes a post has of the given vote type.

getPostVoteType

  • getPostVoteType(userID: string, postID: string): Promise<string>
  • Get the type of vote a user has made on a post.

    Parameters

    • userID: string

      A user's ID.

    • postID: string

      A post's ID.

    Returns Promise<string>

    The type of vote the user made on the post.

getPostVotes

  • getPostVotes(postID: string): Promise<PostVote[]>
  • Get all of the votes on a post.

    Parameters

    • postID: string

      A post's ID.

    Returns Promise<PostVote[]>

    All of the votes on a post.

getUserVotes

  • getUserVotes(userID: string): Promise<PostVote[]>
  • Get all of a user's post votes.

    Parameters

    • userID: string

      A user's ID.

    Returns Promise<PostVote[]>

    All of a user's votes.

getVote

  • getVote(userID: string, postID: string): Promise<PostVote>
  • Get a post vote record.

    Parameters

    • userID: string

      A user's ID.

    • postID: string

      A post's ID.

    Returns Promise<PostVote>

    The post vote record.

getVotes

  • Get all post vote records.

    Returns Promise<PostVote[]>

    All post vote records.

unvote

  • unvote(userID: string, postID: string): Promise<void>
  • Unvote a post.

    Parameters

    • userID: string

      A user's ID.

    • postID: string

      A post's ID.

    Returns Promise<void>

vote

  • vote(userID: string, postID: string, voteType: string): Promise<void>
  • Vote on a post.

    Parameters

    • userID: string

      A user's ID.

    • postID: string

      A post's ID.

    • voteType: string

      The type of vote.

    Returns Promise<void>

voted

  • voted(userID: string, postID: string): Promise<boolean>
  • Check if a post has been voted on by a user.

    Parameters

    • userID: string

      A user's ID.

    • postID: string

      A post's ID.

    Returns Promise<boolean>

    Whether or not the post has been voted on by a user.

Generated using TypeDoc