Home Reference Source
import Post from '~/models/Post.js'
public class | source

Post

Describes a code-golf post

Static Member Summary

Static Public Members
public static get

The current post

Static Method Summary

Static Public Methods
public static

Unwraps from serach Index JSON object

public static

Converts from JSON

Constructor Summary

Public Constructor
public

constructor(postId: number, title: string, body: string, isDeleted: boolean, slug: string, owner: User, dateCreated: Date)

Pass all parameters as object

Member Summary

Public Members
public get
public get
public get

General endpoint for this type of model

public get
public get
public set
public get
public get

Method Summary

Public Methods
public

async getDescription()

Gets the description for this post

public

async getSchema()

Generates a "QAPost" schema

public

async getURL(): string

Returns the canonical URL

public

Gets a post URL sync.

public

Converts to json

Static Public Members

public static get current: Post source

The current post

Static Public Methods

public static fromIndexJSON(JSON: Object): User source

Unwraps from serach Index JSON object

Params:

NameTypeAttributeDescription
JSON Object

Search index JSON

Return:

User (nullable: true)

Created object

public static fromJSON(): Post source

Converts from JSON

Return:

Post

Public Constructors

public constructor(postId: number, title: string, body: string, isDeleted: boolean, slug: string, owner: User, dateCreated: Date) source

Pass all parameters as object

Params:

NameTypeAttributeDescription
postId number

Id of post.

title string

Post title

body string
  • nullable: true

Post body

isDeleted boolean
  • optional
  • default: false

True if is deleted

slug string

Slug of post

owner User
  • nullable: true

Owner of post

dateCreated Date
  • nullable: true

Date created

Public Members

public get body: string source

public get dateCreated: Date source

public get endpoint: string source

General endpoint for this type of model

public get id: number source

public get isDeleted: boolean source

public set isDeleted: boolean source

public get owner: User source

public get title: string source

Public Methods

public async getDescription() source

Gets the description for this post

public async getSchema() source

Generates a "QAPost" schema

public async getURL(): string source

Returns the canonical URL

Return:

string

public getURLSync(): string source

Gets a post URL sync. May not be canonical

Return:

string

public toJSON(): Object source

Converts to json

Return:

Object

json object