Skip to content

CitizenMedia-TW/broker-service

Repository files navigation

Routes

Auth

/auth

POST /auth/google

/* req */
{ id_token: string }
/* res */
{
  user: {
    { name: string, email: string, avatar: string, jwt_token: string, id: string }
  }
}
/* jwt_token */
jwt_token = {
    name: string,
    email: string,
    id: string
}

POST /auth/credentials

/* req */
{ email: string, password: string }
/* res */
{ name: string, email: string, avatar: string, jwt_token: string, id: string }
/* jwt_token */
jwt_token = {
    name: string,
    email: string,
    id: string
}

POST /auth/register

/* req */
{ username: string, email: string, password: string }
/* res */
{ message: string }

GET /auth/verify

/* req */
{
  headers: {
    authorization: jwt_token
  }
}
/* res */
{
  verified: boolean
}

POST /auth/forget-password

/* req */
{ email: string }
/* res */
{ resetToken: string, id: string } // Will send links to req.body.email

POST /auth/reset-password

/* req */
{ id: string, password: string, token: string } // Token is the resetToken get from /auth/forget-password
/* res */
{ message: string }

Story

/story

POST /story/retrieveById

/* req */
{
  id: string
} // Id of the story
/* res */
{
  story: {
    /* story object */
  }
}

GET /story/retrieve

/* req */
{
  headers: {
    authorizations: string
  }
}
/* res */
;[
  {
    /* story object */
  },
]

POST /story/like

/* req */
{ storyId: string, userId: string }
/* res */
string // ('Unlike success' or 'Like success')

POST /story/create

/* req */
{ id: string, content: string, title: string, subTitle: string, tags: string[] }
/* res */
{ message: string, newStoryId: string }

POST /story/comment

/* req */
{ id: string, comment: string, commenter_id: string } // id: Id of the story
/* res */
string

User

/user

GET /user/profile-links

/* req */
{
  headers: {
    authorization: string
  }
}
/* res */
{
  profileLinks: {
    user.prfileLInks
  }
}
user.profileLinks: {
    facebook: { type: String },
    instagram: { type: String },
    twitter: { type: String },
    linkedin: { type: String },
    youtube: { type: String },
    website: { type: String },
},

POST /user/profile-links

/* req */
{ facebook: string, twitter: string, instagram: string ... }
// available options: facebook, instagram, twitter, linkedin, youtube, website
// leave blank to delete, e.x.
{ facebook: 'https://facebook.com', instagram: '' }
/* res */
{ profileLinks: { user.profileLinks } }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published