Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PostService

Post services.

Hierarchy

Constructors

constructor

Properties

Readonly dbm

dbm: default

Methods

createPost

  • createPost(userID: string, content: string, imageData: Buffer[], location: string, city: string, country: string, locationTypeID: number, programID: number, rating: RatingParams, threeWords: string, address?: string, phone?: string, website?: string): Promise<string>
  • Create a post.

    Parameters

    • userID: string

      The ID of the user making the post.

    • content: string

      The text content of the post.

    • imageData: Buffer[]

      The binary data of the images associated with the post.

    • location: string

      The post's location.

    • city: string

      The location's city.

    • country: string

      The location's country.

    • locationTypeID: number

      The type ID of location.

    • programID: number

      The ID of the program the user is in.

    • rating: RatingParams

      The user's rating of the location.

    • threeWords: string

      Three words to describe the location.

    • address: string = null

      The location's address.

    • phone: string = null

      The location's phone number.

    • website: string = null

      The location's website.

    Returns Promise<string>

    The new post's ID.

deletePost

  • deletePost(postID: string): Promise<void>
  • Delete a post.

    Parameters

    • postID: string

      A post's ID.

    Returns Promise<void>

deleteUserPosts

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

    Parameters

    • userID: string

      A user's ID.

    Returns Promise<void>

editPost

  • editPost(postID: string, postDetails: PostDetails): Promise<void>
  • Edit a post, given the parts of the post that have been edited.

    Parameters

    • postID: string

      A post's ID.

    • postDetails: PostDetails

      The post details.

    Returns Promise<void>

getPost

  • getPost(postID: string): Promise<Post>
  • Get a post.

    Parameters

    • postID: string

      A post's ID.

    Returns Promise<Post>

    The post.

getPostContent

  • getPostContent(postID: string): Promise<string>
  • Get a post's text content.

    Parameters

    • postID: string

      A post's ID.

    Returns Promise<string>

    The post's text content.

getPostImages

  • getPostImages(postID: string): Promise<Image[]>
  • Get a post's images.

    Parameters

    • postID: string

      A post's ID.

    Returns Promise<Image[]>

    The images associated with the post.

getPostRating

  • getPostRating(postID: string): Promise<Rating>
  • Get a post's rating.

    Parameters

    • postID: string

      A post's ID.

    Returns Promise<Rating>

    The post's rating.

getPostUser

  • getPostUser(postID: string): Promise<User>
  • Get the user who made the post.

    Parameters

    • postID: string

      A post's ID.

    Returns Promise<User>

    The user who made the post.

getUnapproved

  • Get all unapproved posts.

    Returns Promise<UnapprovedPost[]>

    All unapproved posts.

getUserPosts

  • getUserPosts(userID: string): Promise<UserPost[]>
  • Get all of a user's posts.

    Parameters

    • userID: string

      A user's ID.

    Returns Promise<UserPost[]>

    A list of all posts made by the user.

isApproved

  • isApproved(postID: string): Promise<boolean>
  • Check if a post has been approved.

    Parameters

    • postID: string

      A post's ID.

    Returns Promise<boolean>

    Whether or not the post has been approved by an admin.

postExists

  • postExists(postID: string): Promise<boolean>
  • Check if a post exists.

    Parameters

    • postID: string

      A post's ID.

    Returns Promise<boolean>

    Whether or not the post exists.

setApproved

  • setApproved(postID: string, approved?: boolean): Promise<void>
  • Set a post's approved status.

    Parameters

    • postID: string

      A post's ID.

    • approved: boolean = true

      Approved status.

    Returns Promise<void>

setPostContent

  • setPostContent(postID: string, content: string): Promise<void>
  • Set a post's text content.

    Parameters

    • postID: string

      A post's ID.

    • content: string

      The new text content of a post.

    Returns Promise<void>

setPostImages

  • setPostImages(postID: string, imageData: Buffer[]): Promise<string[]>
  • Set a post's images.

    Parameters

    • postID: string

      A post's ID.

    • imageData: Buffer[]

      The binary data of the new images.

    Returns Promise<string[]>

    The IDs of the new images.

Generated using TypeDoc