Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This document describes about Discussion Forum architecture

...

  1. Categories list

    1. Category list with details

    2. Category list with only name(as a list)


  2. Topics list

    1. Filter options & search query should be the config for the widget (optional for now)
      Note: Think this can be independent widget itself can be used at any place


  3. Topic thread(with new post, list of posts & reply to post)


  4. Create a Topic

  5. Create Category


  6. Post/Reply

    1. Post card

    2. Replay to post

    3. After posting the reply(expanded view)

...

Front-end

Middleware

Nodebb

ContentCreator(SB role)

ContentCreator → Maderator

Moderator

Anonymous/Public

Public → User

User

API’s

NodeBB API’s documentation: https://docs.nodebb.org/api/#tag/topics/paths/~1api~1popular/get

NodeBB plugin:
nodebb-plugin-write-api : https://github.com/NodeBB/nodebb-plugin-write-api/blob/master/routes/v2/readme.md

POST: Create forum

POST api/discussion/v1/category/create

Request

Code Block
request: {
    "context": {
        "type": "Batch"  // Possible types: Quiz/Resource/Course/Textbook/Batch etc..
        "identifier":"0126825293972439041",  // BatchId in this example
        "channel": 01238392   // Optional: Channel/TenantId in this example
    },
    "parentCid": 1929 // Optional: parent category Id
    "name": "Course 1- Batch 1",
    "description": ""
}

Response

Code Block
{
    "id": "api.org.preferences.read",
    "ver": "v2",
    "ts": "2020-08-13 18:35:50:148+0000",
    "params": {
        "resmsgid": null,
        "msgid": "3c75d002-15a6-3d5e-8dcd-1bf6179548b2",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "categoryId": 12356 // "nodebb category id"
    }
}

POST: Creating Group

POST api/discussion/v1/group/create 

Request

Code Block
request: {
    "categoryId": 1929 // parent category Id
    "userId": [creator],
    "permissions": ["moderator"]  // Default "guest" priviledges
}

Response

Code Block
{
    "id": "api.org.preferences.read",
    "ver": "v2",
    "ts": "2020-08-13 18:35:50:148+0000",
    "params": {
        "resmsgid": null,
        "msgid": "3c75d002-15a6-3d5e-8dcd-1bf6179548b2",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "group": 38301 // "nodebb group id"
    }
}

POST: Add user to Group

POST api/discussion/v1/group/membership/ 

Request

Code Block
request: {
    "groupId": [2673] // GroupId
    "userId": [2345] // Nodebb UserID
}

Response

Code Block
{
    "id": "api.org.preferences.read",
    "ver": "v2",
    "ts": "2020-08-13 18:35:50:148+0000",
    "params": {
        "resmsgid": null,
        "msgid": "3c75d002-15a6-3d5e-8dcd-1bf6179548b2",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "status": ok // "nodebb category id"
    }
}

Note:

By default, all the users with get guest privileges

POST: User privileges

POST api/discussion/v1/privileges/ 

Request

Code Block
request: {
    "categoryId": 1929 // parent category Id
    "groupId": [2673] // Optional: GroupId
    "userId": [2345] // Optional: Nodebb UserID
    "permissions": ["read", "vote", "post", "topic", "moderate"]
}

Response

Code Block
{
    "id": "api.org.preferences.read",
    "ver": "v2",
    "ts": "2020-08-13 18:35:50:148+0000",
    "params": {
        "resmsgid": null,
        "msgid": "3c75d002-15a6-3d5e-8dcd-1bf6179548b2",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "status": ok // "nodebb category id"
    }
}

note:

GroupId or userId either one of these is mandatory.

Use authentication

Description: