Sign inSign up

juffalow/comment-service

By juffalow

•Updated almost 3 years ago

Image
0

228

juffalow/comment-service repository overview

⁠Comment Service

This project is Open Source and source code is available on GitHub⁠.

⁠Routes

RequestPathDescriptionDataResponse
POST/commentsCreates new comment
{
  "parentId": number,
  "entityName": string,
  "entityId": number,
  "content": string,
  "meta": {
    "<key>": <value>
  }
}
{
  "error": Error,
  "data": {
    "comment": Comment;
  }
}
PUT/comments/:commentIdUpdates existing comment
{
  "content"?: string,
  "meta"?: {
    "<key>": <value>
  }
}
{
  "error": Error,
  "data": {
    "comment": Comment;
  }
}
GET/commentsList comments
{
  "error": Error,
  "data": {
    "comments": Comment[];
  }
}
POST/comments/:commentId/reactionsAdds reaction to specified comment
{
  "content": string
}
{
  "error": Error,
  "data": {
    "reaction": Reaction;
  }
}
DELETE/comments/:commentId/reactions/:reactionIdRemoves reaction from specified comment
{
  "error": Error,
  "data": {
    "reaction": Reaction;
  }
}

⁠Services

⁠Token

Token service is used to create and verify access tokens.

JWT uses JWT⁠:

SERVICES_TOKEN_TYPE=JWT
SERVICES_TOKEN_SECRET=secret
SERVICES_TOKEN_TTL=900

⁠Callbacks

⁠onCommentCreate

When new comment is successfully created (no error) the service will notify all subscribed services.

Set in the config:

{
  callbacks: {
    onCommentCreate: [
      type: 'HTTP',
      url: 'https://',
    ],
  },
}

Data:

{
  name: 'comment_create',
  organization: {
    id: number | null;
  },
  user: {
    id: number,
  },
  parameters: {
    id: number,
    parentId: number | null,
    organizationId: number | null,
    userId: number | null,
    entityName: string,
    entityId: number,
    content: string,
    createdAt: string,
    updatedAt: string,
  },
}

⁠License

MIT license⁠

Tag summary

Content type

Image

Digest

sha256:51b1843ac…

Size

92.1 MB

Last updated

almost 3 years ago

docker pull juffalow/comment-service