init from origin + update
This commit is contained in:
49
server/routers/coder/forum/categories.json
Normal file
49
server/routers/coder/forum/categories.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"success": true,
|
||||
"body": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Interview Question",
|
||||
"description": "Share and discuss questions from real technical interviews",
|
||||
"path": "interview-question"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Interview Experience",
|
||||
"description": "Share details about the interview processes you have been through",
|
||||
"path": "interview-experience"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Compensation",
|
||||
"description": "What kind of offers have you received? Share it here!",
|
||||
"path": "compensation"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Career",
|
||||
"description": "Question about working in the tech industry? Discuss your career questions here.",
|
||||
"path": "career"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Study Guide",
|
||||
"description": "Share your study guide or summaries for certain topics/patterns",
|
||||
"path": "study-guide"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"title": "General Discussion",
|
||||
"description": "Discuss anything not covered in other categories",
|
||||
"path": "general-discussion"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"title": "Support & Feedback",
|
||||
"description": "Get help on issues or submit feedback regarding LeetCode",
|
||||
"path": "feedback"
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"warnings": []
|
||||
}
|
||||
3
server/routers/coder/forum/error.json
Normal file
3
server/routers/coder/forum/error.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"status": "error"
|
||||
}
|
||||
96
server/routers/coder/forum/index.js
Normal file
96
server/routers/coder/forum/index.js
Normal file
@@ -0,0 +1,96 @@
|
||||
const router = require('express').Router();
|
||||
|
||||
const { getResponse } = require('../../../utils/common');
|
||||
const {
|
||||
getTags,
|
||||
connect,
|
||||
findTags,
|
||||
insertTag,
|
||||
getCategories,
|
||||
getTopicsByCategoryId,
|
||||
getTopicById,
|
||||
getCommentsByTopicId,
|
||||
insertComment,
|
||||
getCategoryByPath,
|
||||
insertTopic,
|
||||
} = require('../controllers');
|
||||
|
||||
connect();
|
||||
|
||||
router.get('/forum/topic-categories', async (req, res) => {
|
||||
const errors = [];
|
||||
const categories = await getCategories().catch((e) => errors.push(e.message));
|
||||
res.send(getResponse(errors, categories));
|
||||
});
|
||||
|
||||
router.get('/forum/topic-categories/:groupId', async (req, res) => {
|
||||
const errors = [];
|
||||
const category = await getCategoryByPath(req.params.groupId).catch((e) => errors.push(e.message));
|
||||
res.send(getResponse(errors, category));
|
||||
});
|
||||
|
||||
router.get('/forum/topic-comments/:topicId', async (req, res) => {
|
||||
const errors = [];
|
||||
const comments = await getCommentsByTopicId(req.params.topicId, req.query.page).catch((e) => errors.push(e.message));
|
||||
res.send(getResponse(errors, comments));
|
||||
});
|
||||
|
||||
router.post('/forum/topic-comments', async (req, res) => {
|
||||
const errors = [];
|
||||
if (!req.body) {
|
||||
errors.push('Bad request, no body');
|
||||
res.send(getResponse(errors, undefined));
|
||||
} else {
|
||||
const comment = await insertComment(req.body).catch((e) => errors.push(e.message));
|
||||
res.send(getResponse(errors, comment));
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/forum/topic-list/:id', async (req, res) => {
|
||||
const errors = [];
|
||||
const topics = await getTopicsByCategoryId(req.params.id, req.query.page).catch((e) => errors.push(e.message));
|
||||
res.send(getResponse(errors, topics));
|
||||
});
|
||||
|
||||
router.get('/forum/topic/:id', async (req, res) => {
|
||||
const errors = [];
|
||||
const topic = await getTopicById(req.params.id).catch((e) => errors.push(e.message));
|
||||
res.send(getResponse(errors, topic));
|
||||
});
|
||||
|
||||
router.post('/forum/topic', async (req, res) => {
|
||||
const errors = [];
|
||||
if (!req.body) {
|
||||
errors.push('Bad request, no body');
|
||||
res.send(getResponse(errors, undefined));
|
||||
} else {
|
||||
const topic = await insertTopic(req.body).catch((e) => errors.push(e.message));
|
||||
res.send(getResponse(errors, topic));
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/forum/topic-tags', async (req, res) => {
|
||||
const errors = [];
|
||||
if (req.query.search !== undefined) {
|
||||
const tags = await findTags(req.query.search).catch((e) => errors.push(e.message));
|
||||
res.send(getResponse(errors, tags));
|
||||
} else {
|
||||
const tags = await getTags().catch((e) => errors.push(e.message));
|
||||
res.send(getResponse(errors, tags));
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/forum/topic-tags', async (req, res) => {
|
||||
const errors = [];
|
||||
const tags = await insertTag(req.body?.name).catch((e) => errors.push(e.message));
|
||||
res.send(getResponse(errors, tags));
|
||||
});
|
||||
|
||||
router.get('/forum/stub/:data', (request, response) => {
|
||||
console.log(request.params);
|
||||
process.env.stub = request.params.data;
|
||||
|
||||
response.sendStatus(200);
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
29
server/routers/coder/forum/topic-comments.json
Normal file
29
server/routers/coder/forum/topic-comments.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"success": true,
|
||||
"body": [
|
||||
{
|
||||
"id": 1,
|
||||
"topicId": 1,
|
||||
"voteCount": 36,
|
||||
"content": "wish for offer",
|
||||
"updationDate": 1563064458,
|
||||
"creationDate": 1563064458,
|
||||
"authorId": 1,
|
||||
"authorIsModerator": false,
|
||||
"isOwnPost": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"topicId": 1,
|
||||
"voteCount": 10,
|
||||
"content": "Thank you for your explantion",
|
||||
"updationDate": 1559050657,
|
||||
"creationDate": 1559050657,
|
||||
"authorId": 1,
|
||||
"authorIsModerator": false,
|
||||
"isOwnPost": false
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"warnings": []
|
||||
}
|
||||
235
server/routers/coder/forum/topic-list.json
Normal file
235
server/routers/coder/forum/topic-list.json
Normal file
@@ -0,0 +1,235 @@
|
||||
{
|
||||
"success": true,
|
||||
"body": {
|
||||
"totalNum": 15,
|
||||
"items": [
|
||||
{
|
||||
"id": 1,
|
||||
"categoryId": 1,
|
||||
"title": "How to write an Interview Question post",
|
||||
"commentCount": 2,
|
||||
"viewCount": 0,
|
||||
"tagsId": [1, 2],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1524865315,
|
||||
"creationDate": 1524865315,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"categoryId": 1,
|
||||
"title": "Microsoft Online Assessment Questions",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [1, 2],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1570318826,
|
||||
"creationDate": 1570318826,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"categoryId": 2,
|
||||
"title": "Google Online Assessment Questions",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [1],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1565090199,
|
||||
"creationDate": 1565090199,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"categoryId": 2,
|
||||
"title": "Meta | March 2022 | Onsite USA E4",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [3, 4],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649546823,
|
||||
"creationDate": 1649546823,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"categoryId": 2,
|
||||
"title": "Flipkart | SDE 2 | Machine Coding",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [4, 5, 6],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649599102,
|
||||
"creationDate": 1649599102,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"categoryId": 3,
|
||||
"title": "Google | SDE (L4/L5) | Virtual Onsite | PENDING",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [7, 8],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649537604,
|
||||
"creationDate": 1649537604,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"categoryId": 3,
|
||||
"title": "Leetcode not taking track of submission and not filled the active days box",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [11, 12],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649486170,
|
||||
"creationDate": 1649486170,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"categoryId": 4,
|
||||
"title": "Salesforce India || AMTS (2022 Graduate) || Online Assessment || Off Campus",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [10, 20],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649572752,
|
||||
"creationDate": 1649572752,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"categoryId": 5,
|
||||
"title": "Meta | February Phone Interview | E4 | USA",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [14, 15],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649462307,
|
||||
"creationDate": 1649462307,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"categoryId": 5,
|
||||
"title": "Maximize minimum array",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [11, 7],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649652616,
|
||||
"creationDate": 1649652616,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"categoryId": 6,
|
||||
"title": "Yelp | London | April 2022 | Screening + Virtual On-Site | Full Stack Role",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [7, 12],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649637943,
|
||||
"creationDate": 1649637943,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"categoryId": 6,
|
||||
"title": "[System Design Question] Design a Game Matching system",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [8, 11],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649637516,
|
||||
"creationDate": 1649637516,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"categoryId": 6,
|
||||
"title": "Uber | Data Analyst | SF | 2022-04",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [1, 12],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649625709,
|
||||
"creationDate": 1649625709,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"categoryId": 7,
|
||||
"title": "Google Online Assessment",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [11, 2],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649622307,
|
||||
"creationDate": 1649622307,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"categoryId": 7,
|
||||
"title": "Amazon || SDE 2 || OA",
|
||||
"commentCount": 0,
|
||||
"viewCount": 0,
|
||||
"tagsId": [],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1649619969,
|
||||
"creationDate": 1649619969,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"errors": [],
|
||||
"warnings": []
|
||||
}
|
||||
107
server/routers/coder/forum/topic-tags.json
Normal file
107
server/routers/coder/forum/topic-tags.json
Normal file
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"success": true,
|
||||
"body": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "google",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "phone screen",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "amazon",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "facebook",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "online assessment",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"name": "onsite",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"name": "system design",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"name": "microsoft",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"name": "online assesment",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"name": "graph",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"name": "uber",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"name": "intern",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"name": "amazon online assesment",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"name": "bloomberg",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"name": "amazon interview",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"name": "new grad",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"name": "interview",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"name": "amazon sde2",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"name": "array",
|
||||
"numTopics": 0
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"name": "phone-interview",
|
||||
"numTopics": 0
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"warnings": []
|
||||
}
|
||||
20
server/routers/coder/forum/topic.json
Normal file
20
server/routers/coder/forum/topic.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"success": true,
|
||||
"body": {
|
||||
"id": 1,
|
||||
"categoryId": 1,
|
||||
"title": "How to write an Interview Question post",
|
||||
"commentCount": 2,
|
||||
"viewCount": 0,
|
||||
"tagsId": [1, 2],
|
||||
"voteCount": 0,
|
||||
"voteStatus": 0,
|
||||
"content": "## Heading level 2\n#### Heading level 4\nI just love **bold text**.\nItalicized text is the _cat's meow_.\n- Revenue was off the chart.\n- Profits were higher than ever.\n",
|
||||
"updationDate": 1648229493,
|
||||
"creationDate": 1524865315,
|
||||
"authorId": 1,
|
||||
"isOwnPost": true
|
||||
},
|
||||
"errors": [],
|
||||
"warnings": []
|
||||
}
|
||||
6
server/routers/coder/forum/users.json
Normal file
6
server/routers/coder/forum/users.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"success": true,
|
||||
"body": [{ "id": 1, "name": "Test", "avatar": "https://s3-us-west-1.amazonaws.com/s3-lc-upload/assets/default_avatar.jpg" }],
|
||||
"errors": [],
|
||||
"warnings": []
|
||||
}
|
||||
Reference in New Issue
Block a user