Extract @rondo/comments-common
This commit is contained in:
parent
77d9bb9931
commit
61edf10a5b
3
Buildfile
Normal file
3
Buildfile
Normal file
@ -0,0 +1,3 @@
|
||||
add:
|
||||
mkdir packages/$(name)
|
||||
cp -r template/* packages/$(name)/
|
||||
36
package-lock.json
generated
36
package-lock.json
generated
@ -791,6 +791,12 @@
|
||||
"@rondo/client": {
|
||||
"version": "file:packages/client"
|
||||
},
|
||||
"@rondo/comments-client": {
|
||||
"version": "file:packages/comments-client"
|
||||
},
|
||||
"@rondo/comments-common": {
|
||||
"version": "file:packages/comments-common"
|
||||
},
|
||||
"@rondo/common": {
|
||||
"version": "file:packages/common"
|
||||
},
|
||||
@ -800,7 +806,6 @@
|
||||
"bcrypt": "^3.0.3",
|
||||
"body-parser": "^1.18.3",
|
||||
"cls-hooked": "^4.2.2",
|
||||
"config": "^3.0.1",
|
||||
"csurf": "^1.9.0",
|
||||
"email-validator": "^2.0.4",
|
||||
"express": "^4.16.4",
|
||||
@ -844,12 +849,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/config": {
|
||||
"version": "0.0.34",
|
||||
"resolved": "https://registry.npmjs.org/@types/config/-/config-0.0.34.tgz",
|
||||
"integrity": "sha512-jWi9DXx77hnzN4kHCNEvP/kab+nchRLTg9yjXYxjTcMBkuc5iBb3QuwJ4sPrb+nzy1GQjrfyfMqZOdR4i7opRQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/connect": {
|
||||
"version": "3.4.32",
|
||||
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.32.tgz",
|
||||
@ -3402,14 +3401,6 @@
|
||||
"typedarray": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/config/-/config-3.0.1.tgz",
|
||||
"integrity": "sha512-TBNrrk2b6AybUohqXw2AydglFBL9b/+1GG93Di6Fm6x1SyVJ5PYgo+mqY2X0KpU9m0PJDSbFaC5H95utSphtLw==",
|
||||
"requires": {
|
||||
"json5": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"config-chain": {
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz",
|
||||
@ -8269,21 +8260,6 @@
|
||||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
|
||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
||||
},
|
||||
"json5": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
|
||||
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
|
||||
"requires": {
|
||||
"minimist": "^1.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
"dependencies": {
|
||||
"@rondo/client": "file:packages/client",
|
||||
"@rondo/common": "file:packages/common",
|
||||
"@rondo/server": "file:packages/server"
|
||||
"@rondo/server": "file:packages/server",
|
||||
"@rondo/comments-server": "file:packages/comments-server",
|
||||
"@rondo/comments-common": "file:packages/comments-common",
|
||||
"@rondo/comments-client": "file:packages/comments-client"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bcrypt": "^3.0.0",
|
||||
|
||||
@ -1,9 +1,4 @@
|
||||
import {ICommentTree} from './ICommentTree'
|
||||
import {IComment} from './IComment'
|
||||
import {ICredentials} from './ICredentials'
|
||||
import {INewComment} from './INewComment'
|
||||
import {ISite} from './ISite'
|
||||
import {IStory} from './IStory'
|
||||
import {ITeam} from './ITeam'
|
||||
import {IUserTeam} from './IUserTeam'
|
||||
import {IUser} from './IUser'
|
||||
@ -79,143 +74,4 @@ export interface IAPIDef {
|
||||
}
|
||||
}
|
||||
|
||||
// SITE
|
||||
|
||||
'/sites/:domain': {
|
||||
'get': {
|
||||
params: {domain: string}
|
||||
}
|
||||
}
|
||||
|
||||
'/teams/:teamId/sites/:id': {
|
||||
get: {
|
||||
params: {
|
||||
teamId: number
|
||||
id: number
|
||||
}
|
||||
response: ISite | undefined
|
||||
}
|
||||
put: {
|
||||
params: {
|
||||
teamId: number
|
||||
id: number
|
||||
}
|
||||
body: {
|
||||
name?: string
|
||||
domain?: string
|
||||
}
|
||||
response: ISite
|
||||
}
|
||||
delete: {
|
||||
params: {
|
||||
teamId: number
|
||||
id: number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
'/teams/:teamId/sites': {
|
||||
get: {
|
||||
params: {
|
||||
teamId: number
|
||||
}
|
||||
response: ISite[]
|
||||
}
|
||||
post: {
|
||||
params: {
|
||||
teamId: number
|
||||
}
|
||||
body: {
|
||||
name: string
|
||||
domain: string
|
||||
}
|
||||
response: ISite
|
||||
}
|
||||
}
|
||||
|
||||
'/my/sites': {
|
||||
get: {
|
||||
response: ISite[]
|
||||
}
|
||||
}
|
||||
|
||||
// STORY
|
||||
|
||||
'/stories/by-url': {
|
||||
'get': {
|
||||
response: IStory | undefined
|
||||
query: {
|
||||
url: string
|
||||
}
|
||||
}
|
||||
}
|
||||
'/stories/:storyId/comments': {
|
||||
'get': {
|
||||
response: ICommentTree,
|
||||
params: {
|
||||
storyId: number
|
||||
}
|
||||
}
|
||||
'post': {
|
||||
response: IComment,
|
||||
body: INewComment,
|
||||
params: {
|
||||
storyId: number
|
||||
}
|
||||
}
|
||||
}
|
||||
'/stories/:storyId/comments/:parentId': {
|
||||
post: {
|
||||
response: IComment,
|
||||
params: {
|
||||
parentId: number
|
||||
storyId: number
|
||||
},
|
||||
body: INewComment,
|
||||
}
|
||||
}
|
||||
'/comments/:commentId': {
|
||||
get: {
|
||||
response: IComment
|
||||
params: {
|
||||
commentId: number
|
||||
}
|
||||
}
|
||||
put: {
|
||||
response: IComment,
|
||||
body: INewComment,
|
||||
params: {
|
||||
commentId: number
|
||||
}
|
||||
}
|
||||
delete: {
|
||||
params: {
|
||||
commentId: number
|
||||
}
|
||||
}
|
||||
}
|
||||
'/comments/:commentId/vote': {
|
||||
'post': {
|
||||
params: {
|
||||
commentId: number
|
||||
}
|
||||
}
|
||||
'delete': {
|
||||
params: {
|
||||
commentId: number
|
||||
}
|
||||
}
|
||||
}
|
||||
'/comments/:commentId/spam': {
|
||||
'post': {
|
||||
params: {
|
||||
commentId: number
|
||||
}
|
||||
}
|
||||
'delete': {
|
||||
params: {
|
||||
commentId: number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
export interface IComment {
|
||||
// TODO make readonly
|
||||
id: number
|
||||
storyId: number
|
||||
message: string
|
||||
votes: number
|
||||
spams: number
|
||||
parentId: number
|
||||
userId: number
|
||||
childrenIds?: number[]
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
import {IComment} from './IComment'
|
||||
|
||||
export interface ICommentTree {
|
||||
rootIds: number[],
|
||||
commentsById: {
|
||||
[key: number]: IComment
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
export interface INewComment {
|
||||
message: string
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
export interface ISite {
|
||||
readonly id: number
|
||||
readonly name: string
|
||||
readonly domain: string
|
||||
readonly teamId: number
|
||||
readonly userId: number
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
export interface IStory {
|
||||
readonly id: number
|
||||
readonly url: string
|
||||
readonly siteId: number
|
||||
}
|
||||
@ -1,13 +1,8 @@
|
||||
export * from './IAPIDef'
|
||||
export * from './IComment'
|
||||
export * from './ICommentTree'
|
||||
export * from './ICredentials'
|
||||
export * from './INewComment'
|
||||
export * from './IRequestParams'
|
||||
export * from './IRole'
|
||||
export * from './IRoutes'
|
||||
export * from './ISite'
|
||||
export * from './IStory'
|
||||
export * from './ITeam'
|
||||
export * from './IUser'
|
||||
export * from './URLFormatter'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user