├── .editorconfig ├── .env.example ├── .eslintignore ├── .eslintrc ├── .gitignore ├── .prettierrc ├── README.md ├── api ├── .gitkeep ├── article │ ├── config │ │ └── routes.json │ ├── controllers │ │ └── article.js │ ├── documentation │ │ └── 1.0.0 │ │ │ └── article.json │ ├── models │ │ ├── article.js │ │ └── article.settings.json │ └── services │ │ └── article.js └── comment │ ├── config │ └── routes.json │ ├── controllers │ └── comment.js │ ├── documentation │ └── 1.0.0 │ │ └── comment.json │ ├── models │ ├── comment.js │ └── comment.settings.json │ └── services │ └── comment.js ├── config ├── database.js ├── functions │ ├── bootstrap.js │ ├── cron.js │ └── responses │ │ └── 404.js └── server.js ├── extensions ├── .gitkeep ├── email │ └── documentation │ │ └── 1.0.0 │ │ └── email-Email.json ├── upload │ └── documentation │ │ └── 1.0.0 │ │ └── upload-File.json └── users-permissions │ ├── config │ └── jwt.js │ ├── documentation │ └── 1.0.0 │ │ ├── users-permissions-Role.json │ │ └── users-permissions-User.json │ └── models │ └── User.settings.json ├── favicon.ico ├── package.json ├── public ├── robots.txt └── uploads │ └── .gitkeep └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [{package.json,*.yml}] 12 | indent_style = space 13 | indent_size = 2 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | HOST=0.0.0.0 2 | PORT=1337 3 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | .cache 2 | build 3 | **/node_modules/** 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": "eslint:recommended", 4 | "env": { 5 | "commonjs": true, 6 | "es6": true, 7 | "node": true, 8 | "browser": false 9 | }, 10 | "parserOptions": { 11 | "ecmaFeatures": { 12 | "experimentalObjectRestSpread": true, 13 | "jsx": false 14 | }, 15 | "sourceType": "module" 16 | }, 17 | "globals": { 18 | "strapi": true 19 | }, 20 | "rules": { 21 | "indent": ["error", 2, { "SwitchCase": 1 }], 22 | "linebreak-style": ["error", "unix"], 23 | "no-console": 0, 24 | "quotes": ["error", "single"], 25 | "semi": ["error", "always"] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ############################ 2 | # OS X 3 | ############################ 4 | 5 | .DS_Store 6 | .AppleDouble 7 | .LSOverride 8 | Icon 9 | .Spotlight-V100 10 | .Trashes 11 | ._* 12 | 13 | 14 | ############################ 15 | # Linux 16 | ############################ 17 | 18 | *~ 19 | 20 | 21 | ############################ 22 | # Windows 23 | ############################ 24 | 25 | Thumbs.db 26 | ehthumbs.db 27 | Desktop.ini 28 | $RECYCLE.BIN/ 29 | *.cab 30 | *.msi 31 | *.msm 32 | *.msp 33 | 34 | 35 | ############################ 36 | # Packages 37 | ############################ 38 | 39 | *.7z 40 | *.csv 41 | *.dat 42 | *.dmg 43 | *.gz 44 | *.iso 45 | *.jar 46 | *.rar 47 | *.tar 48 | *.zip 49 | *.com 50 | *.class 51 | *.dll 52 | *.exe 53 | *.o 54 | *.seed 55 | *.so 56 | *.swo 57 | *.swp 58 | *.swn 59 | *.swm 60 | *.out 61 | *.pid 62 | 63 | 64 | ############################ 65 | # Logs and databases 66 | ############################ 67 | 68 | .tmp 69 | *.log 70 | *.sql 71 | *.sqlite 72 | *.sqlite3 73 | 74 | 75 | ############################ 76 | # Misc. 77 | ############################ 78 | 79 | *# 80 | ssl 81 | .idea 82 | nbproject 83 | public/uploads/* 84 | !public/uploads/.gitkeep 85 | 86 | ############################ 87 | # Node.js 88 | ############################ 89 | 90 | lib-cov 91 | lcov.info 92 | pids 93 | logs 94 | results 95 | node_modules 96 | .node_history 97 | 98 | ############################ 99 | # Tests 100 | ############################ 101 | 102 | testApp 103 | coverage 104 | 105 | ############################ 106 | # Strapi 107 | ############################ 108 | 109 | .env 110 | license.txt 111 | exports 112 | *.cache 113 | build 114 | .strapi-updater.json 115 | 116 | .yalc 117 | yalc.lock -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # articles-server 2 | 3 | 리액트 네이티브를 다루는 기술의 15장 React-Query에서 사용할 Strapi로 만든 샘플 게시글 서버 4 | 5 | http://bit.ly/articles-server-docs 6 | 7 | 서버 실행 8 | 9 | ``` 10 | $ yarn develop 11 | ``` 12 | -------------------------------------------------------------------------------- /api/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velopert/articles-server/62d24dfb7c2242ca1204fa404e2b370332510cbf/api/.gitkeep -------------------------------------------------------------------------------- /api/article/config/routes.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes": [ 3 | { 4 | "method": "GET", 5 | "path": "/articles", 6 | "handler": "article.find", 7 | "config": { 8 | "policies": [] 9 | } 10 | }, 11 | { 12 | "method": "GET", 13 | "path": "/articles/count", 14 | "handler": "article.count", 15 | "config": { 16 | "policies": [] 17 | } 18 | }, 19 | { 20 | "method": "GET", 21 | "path": "/articles/:id", 22 | "handler": "article.findOne", 23 | "config": { 24 | "policies": [] 25 | } 26 | }, 27 | { 28 | "method": "POST", 29 | "path": "/articles", 30 | "handler": "article.create", 31 | "config": { 32 | "policies": [] 33 | } 34 | }, 35 | { 36 | "method": "PUT", 37 | "path": "/articles/:id", 38 | "handler": "article.update", 39 | "config": { 40 | "policies": [] 41 | } 42 | }, 43 | { 44 | "method": "DELETE", 45 | "path": "/articles/:id", 46 | "handler": "article.delete", 47 | "config": { 48 | "policies": [] 49 | } 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /api/article/controllers/article.js: -------------------------------------------------------------------------------- 1 | const { sanitizeEntity } = require('strapi-utils'); 2 | 3 | module.exports = { 4 | async create(ctx) { 5 | // 사용자의 id를 데이터에 추가 6 | ctx.request.body.user = ctx.state.user.id; 7 | // article 데이터 생성 8 | const entity = await strapi.services.article.create(ctx.request.body); 9 | // 잘못된 필드 및 Private 값 제외하고 반환 10 | return sanitizeEntity(entity, { model: strapi.models.article }); 11 | }, 12 | 13 | async update(ctx) { 14 | const { id } = ctx.params; // URL 파라미터에서 id 추출 15 | const article = await strapi.services.article.findOne({ id }); // id 로 데이터 조회 16 | 17 | // 데이터가 존재하지 않을 때 18 | if (!article) { 19 | return ctx.throw(404); 20 | } 21 | 22 | // user 정보는 변경할 수 없도록 처리 23 | if (ctx.request.body.user) { 24 | return ctx.throw(400, 'user field cannot be changed'); 25 | } 26 | 27 | // 사용자의 id 와 article의 작성자 id가 일치하는지 확인 28 | if (ctx.state.user.id !== article.user.id) { 29 | return ctx.unauthorized(`You can't update this entry`); 30 | } 31 | // article 데이터 업데이트 32 | const entity = await strapi.services.article.update( 33 | { id }, 34 | ctx.request.body 35 | ); 36 | 37 | // 응답 반환 38 | return sanitizeEntity(entity, { model: strapi.models.article }); 39 | }, 40 | 41 | async delete(ctx) { 42 | const { id } = ctx.params; // URL 파라미터에서 id 추출 43 | const article = await strapi.services.article.findOne({ id }); // id 로 데이터 조회 44 | 45 | // 데이터가 존재하지 않을 때 46 | if (!article) { 47 | return ctx.throw(404); 48 | } 49 | 50 | // 사용자의 id 와 article의 작성자 id가 일치하는지 확인 51 | if (ctx.state.user.id !== article.user.id) { 52 | return ctx.unauthorized(`You can't remove this entry`); 53 | } 54 | 55 | // 데이터 삭제 56 | await strapi.services.article.delete({ id }); 57 | 58 | // 응답 반환 59 | ctx.status = 204; // no content 60 | }, 61 | }; 62 | -------------------------------------------------------------------------------- /api/article/documentation/1.0.0/article.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": { 3 | "/articles": { 4 | "get": { 5 | "deprecated": false, 6 | "description": "", 7 | "responses": { 8 | "200": { 9 | "description": "response", 10 | "content": { 11 | "application/json": { 12 | "schema": { 13 | "type": "array", 14 | "items": { 15 | "$ref": "#/components/schemas/Article" 16 | } 17 | } 18 | } 19 | } 20 | }, 21 | "403": { 22 | "description": "Forbidden", 23 | "content": { 24 | "application/json": { 25 | "schema": { 26 | "$ref": "#/components/schemas/Error" 27 | } 28 | } 29 | } 30 | }, 31 | "404": { 32 | "description": "Not found", 33 | "content": { 34 | "application/json": { 35 | "schema": { 36 | "$ref": "#/components/schemas/Error" 37 | } 38 | } 39 | } 40 | }, 41 | "default": { 42 | "description": "unexpected error", 43 | "content": { 44 | "application/json": { 45 | "schema": { 46 | "$ref": "#/components/schemas/Error" 47 | } 48 | } 49 | } 50 | } 51 | }, 52 | "summary": "", 53 | "tags": [ 54 | "Article" 55 | ], 56 | "parameters": [ 57 | { 58 | "name": "_limit", 59 | "in": "query", 60 | "required": false, 61 | "description": "Maximum number of results possible", 62 | "schema": { 63 | "type": "integer" 64 | }, 65 | "deprecated": false 66 | }, 67 | { 68 | "name": "_sort", 69 | "in": "query", 70 | "required": false, 71 | "description": "Sort according to a specific field.", 72 | "schema": { 73 | "type": "string" 74 | }, 75 | "deprecated": false 76 | }, 77 | { 78 | "name": "_start", 79 | "in": "query", 80 | "required": false, 81 | "description": "Skip a specific number of entries (especially useful for pagination)", 82 | "schema": { 83 | "type": "integer" 84 | }, 85 | "deprecated": false 86 | }, 87 | { 88 | "name": "=", 89 | "in": "query", 90 | "required": false, 91 | "description": "Get entries that matches exactly your input", 92 | "schema": { 93 | "type": "string" 94 | }, 95 | "deprecated": false 96 | }, 97 | { 98 | "name": "_ne", 99 | "in": "query", 100 | "required": false, 101 | "description": "Get records that are not equals to something", 102 | "schema": { 103 | "type": "string" 104 | }, 105 | "deprecated": false 106 | }, 107 | { 108 | "name": "_lt", 109 | "in": "query", 110 | "required": false, 111 | "description": "Get record that are lower than a value", 112 | "schema": { 113 | "type": "string" 114 | }, 115 | "deprecated": false 116 | }, 117 | { 118 | "name": "_lte", 119 | "in": "query", 120 | "required": false, 121 | "description": "Get records that are lower than or equal to a value", 122 | "schema": { 123 | "type": "string" 124 | }, 125 | "deprecated": false 126 | }, 127 | { 128 | "name": "_gt", 129 | "in": "query", 130 | "required": false, 131 | "description": "Get records that are greater than a value", 132 | "schema": { 133 | "type": "string" 134 | }, 135 | "deprecated": false 136 | }, 137 | { 138 | "name": "_gte", 139 | "in": "query", 140 | "required": false, 141 | "description": "Get records that are greater than or equal a value", 142 | "schema": { 143 | "type": "string" 144 | }, 145 | "deprecated": false 146 | }, 147 | { 148 | "name": "_contains", 149 | "in": "query", 150 | "required": false, 151 | "description": "Get records that contains a value", 152 | "schema": { 153 | "type": "string" 154 | }, 155 | "deprecated": false 156 | }, 157 | { 158 | "name": "_containss", 159 | "in": "query", 160 | "required": false, 161 | "description": "Get records that contains (case sensitive) a value", 162 | "schema": { 163 | "type": "string" 164 | }, 165 | "deprecated": false 166 | }, 167 | { 168 | "name": "_in", 169 | "in": "query", 170 | "required": false, 171 | "description": "Get records that matches any value in the array of values", 172 | "schema": { 173 | "type": "array", 174 | "items": { 175 | "type": "string" 176 | } 177 | }, 178 | "deprecated": false 179 | }, 180 | { 181 | "name": "_nin", 182 | "in": "query", 183 | "required": false, 184 | "description": "Get records that doesn't match any value in the array of values", 185 | "schema": { 186 | "type": "array", 187 | "items": { 188 | "type": "string" 189 | } 190 | }, 191 | "deprecated": false 192 | } 193 | ] 194 | }, 195 | "post": { 196 | "deprecated": false, 197 | "description": "Create a new record", 198 | "responses": { 199 | "200": { 200 | "description": "response", 201 | "content": { 202 | "application/json": { 203 | "schema": { 204 | "$ref": "#/components/schemas/Article" 205 | } 206 | } 207 | } 208 | }, 209 | "403": { 210 | "description": "Forbidden", 211 | "content": { 212 | "application/json": { 213 | "schema": { 214 | "$ref": "#/components/schemas/Error" 215 | } 216 | } 217 | } 218 | }, 219 | "404": { 220 | "description": "Not found", 221 | "content": { 222 | "application/json": { 223 | "schema": { 224 | "$ref": "#/components/schemas/Error" 225 | } 226 | } 227 | } 228 | }, 229 | "default": { 230 | "description": "unexpected error", 231 | "content": { 232 | "application/json": { 233 | "schema": { 234 | "$ref": "#/components/schemas/Error" 235 | } 236 | } 237 | } 238 | } 239 | }, 240 | "summary": "", 241 | "tags": [ 242 | "Article" 243 | ], 244 | "requestBody": { 245 | "description": "", 246 | "required": true, 247 | "content": { 248 | "application/json": { 249 | "schema": { 250 | "$ref": "#/components/schemas/NewArticle" 251 | } 252 | } 253 | } 254 | } 255 | } 256 | }, 257 | "/articles/count": { 258 | "get": { 259 | "deprecated": false, 260 | "description": "", 261 | "responses": { 262 | "200": { 263 | "description": "response", 264 | "content": { 265 | "application/json": { 266 | "schema": { 267 | "properties": { 268 | "count": { 269 | "type": "integer" 270 | } 271 | } 272 | } 273 | } 274 | } 275 | }, 276 | "403": { 277 | "description": "Forbidden", 278 | "content": { 279 | "application/json": { 280 | "schema": { 281 | "$ref": "#/components/schemas/Error" 282 | } 283 | } 284 | } 285 | }, 286 | "404": { 287 | "description": "Not found", 288 | "content": { 289 | "application/json": { 290 | "schema": { 291 | "$ref": "#/components/schemas/Error" 292 | } 293 | } 294 | } 295 | }, 296 | "default": { 297 | "description": "unexpected error", 298 | "content": { 299 | "application/json": { 300 | "schema": { 301 | "$ref": "#/components/schemas/Error" 302 | } 303 | } 304 | } 305 | } 306 | }, 307 | "summary": "", 308 | "tags": [ 309 | "Article" 310 | ], 311 | "parameters": [] 312 | } 313 | }, 314 | "/articles/{id}": { 315 | "get": { 316 | "deprecated": false, 317 | "description": "", 318 | "responses": { 319 | "200": { 320 | "description": "response", 321 | "content": { 322 | "application/json": { 323 | "schema": { 324 | "$ref": "#/components/schemas/Article" 325 | } 326 | } 327 | } 328 | }, 329 | "403": { 330 | "description": "Forbidden", 331 | "content": { 332 | "application/json": { 333 | "schema": { 334 | "$ref": "#/components/schemas/Error" 335 | } 336 | } 337 | } 338 | }, 339 | "404": { 340 | "description": "Not found", 341 | "content": { 342 | "application/json": { 343 | "schema": { 344 | "$ref": "#/components/schemas/Error" 345 | } 346 | } 347 | } 348 | }, 349 | "default": { 350 | "description": "unexpected error", 351 | "content": { 352 | "application/json": { 353 | "schema": { 354 | "$ref": "#/components/schemas/Error" 355 | } 356 | } 357 | } 358 | } 359 | }, 360 | "summary": "", 361 | "tags": [ 362 | "Article" 363 | ], 364 | "parameters": [ 365 | { 366 | "name": "id", 367 | "in": "path", 368 | "description": "", 369 | "deprecated": false, 370 | "required": true, 371 | "schema": { 372 | "type": "string" 373 | } 374 | } 375 | ] 376 | }, 377 | "put": { 378 | "deprecated": false, 379 | "description": "Update a record", 380 | "responses": { 381 | "200": { 382 | "description": "response", 383 | "content": { 384 | "application/json": { 385 | "schema": { 386 | "$ref": "#/components/schemas/Article" 387 | } 388 | } 389 | } 390 | }, 391 | "403": { 392 | "description": "Forbidden", 393 | "content": { 394 | "application/json": { 395 | "schema": { 396 | "$ref": "#/components/schemas/Error" 397 | } 398 | } 399 | } 400 | }, 401 | "404": { 402 | "description": "Not found", 403 | "content": { 404 | "application/json": { 405 | "schema": { 406 | "$ref": "#/components/schemas/Error" 407 | } 408 | } 409 | } 410 | }, 411 | "default": { 412 | "description": "unexpected error", 413 | "content": { 414 | "application/json": { 415 | "schema": { 416 | "$ref": "#/components/schemas/Error" 417 | } 418 | } 419 | } 420 | } 421 | }, 422 | "summary": "", 423 | "tags": [ 424 | "Article" 425 | ], 426 | "requestBody": { 427 | "description": "", 428 | "required": true, 429 | "content": { 430 | "application/json": { 431 | "schema": { 432 | "$ref": "#/components/schemas/NewArticle" 433 | } 434 | } 435 | } 436 | }, 437 | "parameters": [ 438 | { 439 | "name": "id", 440 | "in": "path", 441 | "description": "", 442 | "deprecated": false, 443 | "required": true, 444 | "schema": { 445 | "type": "string" 446 | } 447 | } 448 | ] 449 | }, 450 | "delete": { 451 | "deprecated": false, 452 | "description": "Delete a record", 453 | "responses": { 454 | "200": { 455 | "description": "deletes a single record based on the ID supplied", 456 | "content": { 457 | "application/json": { 458 | "schema": { 459 | "type": "integer", 460 | "format": "int64" 461 | } 462 | } 463 | } 464 | }, 465 | "403": { 466 | "description": "Forbidden", 467 | "content": { 468 | "application/json": { 469 | "schema": { 470 | "$ref": "#/components/schemas/Error" 471 | } 472 | } 473 | } 474 | }, 475 | "404": { 476 | "description": "Not found", 477 | "content": { 478 | "application/json": { 479 | "schema": { 480 | "$ref": "#/components/schemas/Error" 481 | } 482 | } 483 | } 484 | }, 485 | "default": { 486 | "description": "unexpected error", 487 | "content": { 488 | "application/json": { 489 | "schema": { 490 | "$ref": "#/components/schemas/Error" 491 | } 492 | } 493 | } 494 | } 495 | }, 496 | "summary": "", 497 | "tags": [ 498 | "Article" 499 | ], 500 | "parameters": [ 501 | { 502 | "name": "id", 503 | "in": "path", 504 | "description": "", 505 | "deprecated": false, 506 | "required": true, 507 | "schema": { 508 | "type": "string" 509 | } 510 | } 511 | ] 512 | } 513 | } 514 | }, 515 | "components": { 516 | "schemas": { 517 | "Article": { 518 | "required": [ 519 | "id" 520 | ], 521 | "properties": { 522 | "id": { 523 | "type": "string" 524 | }, 525 | "title": { 526 | "type": "string" 527 | }, 528 | "body": { 529 | "type": "string" 530 | }, 531 | "user": { 532 | "required": [ 533 | "id", 534 | "username", 535 | "email" 536 | ], 537 | "properties": { 538 | "id": { 539 | "type": "string" 540 | }, 541 | "username": { 542 | "type": "string" 543 | }, 544 | "email": { 545 | "type": "string" 546 | }, 547 | "provider": { 548 | "type": "string" 549 | }, 550 | "password": { 551 | "type": "string" 552 | }, 553 | "resetPasswordToken": { 554 | "type": "string" 555 | }, 556 | "confirmationToken": { 557 | "type": "string" 558 | }, 559 | "confirmed": { 560 | "type": "boolean" 561 | }, 562 | "blocked": { 563 | "type": "boolean" 564 | }, 565 | "role": { 566 | "type": "string" 567 | }, 568 | "created_by": { 569 | "type": "string" 570 | }, 571 | "updated_by": { 572 | "type": "string" 573 | } 574 | } 575 | }, 576 | "published_at": { 577 | "type": "string", 578 | "format": "date-time" 579 | } 580 | } 581 | }, 582 | "NewArticle": { 583 | "properties": { 584 | "title": { 585 | "type": "string" 586 | }, 587 | "body": { 588 | "type": "string" 589 | }, 590 | "user": { 591 | "type": "string" 592 | }, 593 | "comments": { 594 | "type": "array", 595 | "items": { 596 | "type": "string" 597 | } 598 | }, 599 | "published_at": { 600 | "type": "string", 601 | "format": "date-time" 602 | }, 603 | "created_by": { 604 | "type": "string" 605 | }, 606 | "updated_by": { 607 | "type": "string" 608 | } 609 | } 610 | } 611 | } 612 | }, 613 | "tags": [ 614 | { 615 | "name": "Article" 616 | } 617 | ] 618 | } -------------------------------------------------------------------------------- /api/article/models/article.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#lifecycle-hooks) 5 | * to customize this model 6 | */ 7 | 8 | module.exports = {}; 9 | -------------------------------------------------------------------------------- /api/article/models/article.settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "collectionType", 3 | "collectionName": "articles", 4 | "info": { 5 | "name": "Article", 6 | "description": "" 7 | }, 8 | "options": { 9 | "increments": true, 10 | "timestamps": true, 11 | "draftAndPublish": true 12 | }, 13 | "attributes": { 14 | "title": { 15 | "type": "string" 16 | }, 17 | "body": { 18 | "type": "text", 19 | "private": false 20 | }, 21 | "user": { 22 | "plugin": "users-permissions", 23 | "model": "user" 24 | }, 25 | "comments": { 26 | "via": "article", 27 | "private": true, 28 | "collection": "comment" 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /api/article/services/article.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-services) 5 | * to customize this service 6 | */ 7 | 8 | module.exports = {}; 9 | -------------------------------------------------------------------------------- /api/comment/config/routes.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes": [ 3 | { 4 | "method": "POST", 5 | "path": "/articles/:articleId/comments", 6 | "handler": "comment.create", 7 | "config": { 8 | "policies": [] 9 | } 10 | }, 11 | { 12 | "method": "GET", 13 | "path": "/articles/:articleId/comments", 14 | "handler": "comment.find", 15 | "config": { 16 | "policies": [] 17 | } 18 | }, 19 | { 20 | "method": "PUT", 21 | "path": "/articles/:articleId/comments/:id", 22 | "handler": "comment.update", 23 | "config": { 24 | "policies": [] 25 | } 26 | }, 27 | { 28 | "method": "DELETE", 29 | "path": "/articles/:articleId/comments/:id", 30 | "handler": "comment.delete", 31 | "config": { 32 | "policies": [] 33 | } 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /api/comment/controllers/comment.js: -------------------------------------------------------------------------------- 1 | const { sanitizeEntity } = require('strapi-utils'); 2 | 3 | module.exports = { 4 | async create(ctx) { 5 | // 사용자의 id를 데이터에 추가 6 | ctx.request.body.user = ctx.state.user.id; 7 | const { articleId } = ctx.params; 8 | ctx.request.body.article = articleId; 9 | 10 | // 게시글 존재 유무 확인 11 | const article = await strapi.services.article.findOne({ id: articleId }); // id 로 데이터 조회 12 | if (!article) { 13 | ctx.throw(404); 14 | } 15 | 16 | // Comment 데이터 생성 17 | const entity = await strapi.services.comment.create(ctx.request.body); 18 | // 응답 반환 19 | return sanitizeEntity(entity, { model: strapi.models.comment }); 20 | }, 21 | async find(ctx) { 22 | // articleId 로 댓글 조회 23 | const entities = await strapi.services.comment.find({ 24 | article: ctx.params.articleId, 25 | }); 26 | // 각 데이터들에 대하여 sanitizeEntity를 처리하여 응답 반환 27 | return entities.map((entity) => 28 | sanitizeEntity(entity, { model: strapi.models.comment }) 29 | ); 30 | }, 31 | async update(ctx) { 32 | const { articleId, id } = ctx.params; // URL 파라미터 추출 33 | // 댓글 조회 34 | const comment = await strapi.services.comment.findOne({ 35 | id, 36 | article: articleId, 37 | }); 38 | // 데이터가 존재하지 않을 때 39 | if (!comment) { 40 | return ctx.throw(404); 41 | } 42 | // article 또는 user 변경 막기 43 | if (ctx.request.body.article || ctx.request.body.user) { 44 | return ctx.throw(400, 'article or user field cannot be changed'); 45 | } 46 | // 사용자 확인 47 | if (ctx.state.user.id !== comment.user.id) { 48 | return ctx.unauthorized(`You can't update this entry`); 49 | } 50 | // comment 데이터 업데이트 51 | const entity = await strapi.services.comment.update( 52 | { 53 | id, 54 | }, 55 | ctx.request.body 56 | ); 57 | // 응답 반환 58 | return sanitizeEntity(entity, { model: strapi.models.comment }); 59 | }, 60 | async delete(ctx) { 61 | const { articleId, id } = ctx.params; // URL 파라미터 추출 62 | // 댓글 조회 63 | const comment = await strapi.services.comment.findOne({ 64 | id, 65 | article: articleId, 66 | }); 67 | // 데이터가 존재하지 않을 때 68 | if (!comment) { 69 | return ctx.throw(404); 70 | } 71 | 72 | // 사용자 확인 73 | if (ctx.state.user.id !== comment.user.id) { 74 | return ctx.unauthorized(`You can't remove this entry`); 75 | } 76 | 77 | // 데이터 삭제 78 | await strapi.services.comment.delete({ id }); 79 | 80 | ctx.status = 204; 81 | }, 82 | }; 83 | -------------------------------------------------------------------------------- /api/comment/documentation/1.0.0/comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": { 3 | "/articles/{articleId}/comments": { 4 | "post": { 5 | "deprecated": false, 6 | "description": "Create a new record", 7 | "responses": { 8 | "200": { 9 | "description": "response", 10 | "content": { 11 | "application/json": { 12 | "schema": { 13 | "$ref": "#/components/schemas/Comment" 14 | } 15 | } 16 | } 17 | }, 18 | "403": { 19 | "description": "Forbidden", 20 | "content": { 21 | "application/json": { 22 | "schema": { 23 | "$ref": "#/components/schemas/Error" 24 | } 25 | } 26 | } 27 | }, 28 | "404": { 29 | "description": "Not found", 30 | "content": { 31 | "application/json": { 32 | "schema": { 33 | "$ref": "#/components/schemas/Error" 34 | } 35 | } 36 | } 37 | }, 38 | "default": { 39 | "description": "unexpected error", 40 | "content": { 41 | "application/json": { 42 | "schema": { 43 | "$ref": "#/components/schemas/Error" 44 | } 45 | } 46 | } 47 | } 48 | }, 49 | "summary": "", 50 | "tags": [ 51 | "Comment" 52 | ], 53 | "requestBody": { 54 | "description": "", 55 | "required": true, 56 | "content": { 57 | "application/json": { 58 | "schema": { 59 | "$ref": "#/components/schemas/NewComment" 60 | } 61 | } 62 | } 63 | } 64 | }, 65 | "get": { 66 | "deprecated": false, 67 | "description": "", 68 | "responses": { 69 | "200": { 70 | "description": "response", 71 | "content": { 72 | "application/json": { 73 | "schema": { 74 | "type": "array", 75 | "items": { 76 | "$ref": "#/components/schemas/Comment" 77 | } 78 | } 79 | } 80 | } 81 | }, 82 | "403": { 83 | "description": "Forbidden", 84 | "content": { 85 | "application/json": { 86 | "schema": { 87 | "$ref": "#/components/schemas/Error" 88 | } 89 | } 90 | } 91 | }, 92 | "404": { 93 | "description": "Not found", 94 | "content": { 95 | "application/json": { 96 | "schema": { 97 | "$ref": "#/components/schemas/Error" 98 | } 99 | } 100 | } 101 | }, 102 | "default": { 103 | "description": "unexpected error", 104 | "content": { 105 | "application/json": { 106 | "schema": { 107 | "$ref": "#/components/schemas/Error" 108 | } 109 | } 110 | } 111 | } 112 | }, 113 | "summary": "", 114 | "tags": [ 115 | "Comment" 116 | ], 117 | "parameters": [ 118 | { 119 | "name": "articleId", 120 | "in": "path", 121 | "description": "", 122 | "deprecated": false, 123 | "required": true, 124 | "schema": { 125 | "type": "string" 126 | } 127 | }, 128 | { 129 | "name": "_limit", 130 | "in": "query", 131 | "required": false, 132 | "description": "Maximum number of results possible", 133 | "schema": { 134 | "type": "integer" 135 | }, 136 | "deprecated": false 137 | }, 138 | { 139 | "name": "_sort", 140 | "in": "query", 141 | "required": false, 142 | "description": "Sort according to a specific field.", 143 | "schema": { 144 | "type": "string" 145 | }, 146 | "deprecated": false 147 | }, 148 | { 149 | "name": "_start", 150 | "in": "query", 151 | "required": false, 152 | "description": "Skip a specific number of entries (especially useful for pagination)", 153 | "schema": { 154 | "type": "integer" 155 | }, 156 | "deprecated": false 157 | }, 158 | { 159 | "name": "=", 160 | "in": "query", 161 | "required": false, 162 | "description": "Get entries that matches exactly your input", 163 | "schema": { 164 | "type": "string" 165 | }, 166 | "deprecated": false 167 | }, 168 | { 169 | "name": "_ne", 170 | "in": "query", 171 | "required": false, 172 | "description": "Get records that are not equals to something", 173 | "schema": { 174 | "type": "string" 175 | }, 176 | "deprecated": false 177 | }, 178 | { 179 | "name": "_lt", 180 | "in": "query", 181 | "required": false, 182 | "description": "Get record that are lower than a value", 183 | "schema": { 184 | "type": "string" 185 | }, 186 | "deprecated": false 187 | }, 188 | { 189 | "name": "_lte", 190 | "in": "query", 191 | "required": false, 192 | "description": "Get records that are lower than or equal to a value", 193 | "schema": { 194 | "type": "string" 195 | }, 196 | "deprecated": false 197 | }, 198 | { 199 | "name": "_gt", 200 | "in": "query", 201 | "required": false, 202 | "description": "Get records that are greater than a value", 203 | "schema": { 204 | "type": "string" 205 | }, 206 | "deprecated": false 207 | }, 208 | { 209 | "name": "_gte", 210 | "in": "query", 211 | "required": false, 212 | "description": "Get records that are greater than or equal a value", 213 | "schema": { 214 | "type": "string" 215 | }, 216 | "deprecated": false 217 | }, 218 | { 219 | "name": "_contains", 220 | "in": "query", 221 | "required": false, 222 | "description": "Get records that contains a value", 223 | "schema": { 224 | "type": "string" 225 | }, 226 | "deprecated": false 227 | }, 228 | { 229 | "name": "_containss", 230 | "in": "query", 231 | "required": false, 232 | "description": "Get records that contains (case sensitive) a value", 233 | "schema": { 234 | "type": "string" 235 | }, 236 | "deprecated": false 237 | }, 238 | { 239 | "name": "_in", 240 | "in": "query", 241 | "required": false, 242 | "description": "Get records that matches any value in the array of values", 243 | "schema": { 244 | "type": "array", 245 | "items": { 246 | "type": "string" 247 | } 248 | }, 249 | "deprecated": false 250 | }, 251 | { 252 | "name": "_nin", 253 | "in": "query", 254 | "required": false, 255 | "description": "Get records that doesn't match any value in the array of values", 256 | "schema": { 257 | "type": "array", 258 | "items": { 259 | "type": "string" 260 | } 261 | }, 262 | "deprecated": false 263 | } 264 | ] 265 | } 266 | }, 267 | "/articles/{articleId}/comments/{id}": { 268 | "put": { 269 | "deprecated": false, 270 | "description": "Update a record", 271 | "responses": { 272 | "200": { 273 | "description": "response", 274 | "content": { 275 | "application/json": { 276 | "schema": { 277 | "$ref": "#/components/schemas/Comment" 278 | } 279 | } 280 | } 281 | }, 282 | "403": { 283 | "description": "Forbidden", 284 | "content": { 285 | "application/json": { 286 | "schema": { 287 | "$ref": "#/components/schemas/Error" 288 | } 289 | } 290 | } 291 | }, 292 | "404": { 293 | "description": "Not found", 294 | "content": { 295 | "application/json": { 296 | "schema": { 297 | "$ref": "#/components/schemas/Error" 298 | } 299 | } 300 | } 301 | }, 302 | "default": { 303 | "description": "unexpected error", 304 | "content": { 305 | "application/json": { 306 | "schema": { 307 | "$ref": "#/components/schemas/Error" 308 | } 309 | } 310 | } 311 | } 312 | }, 313 | "summary": "", 314 | "tags": [ 315 | "Comment" 316 | ], 317 | "requestBody": { 318 | "description": "", 319 | "required": true, 320 | "content": { 321 | "application/json": { 322 | "schema": { 323 | "$ref": "#/components/schemas/NewComment" 324 | } 325 | } 326 | } 327 | }, 328 | "parameters": [ 329 | { 330 | "name": "articleId", 331 | "in": "path", 332 | "description": "", 333 | "deprecated": false, 334 | "required": true, 335 | "schema": { 336 | "type": "string" 337 | } 338 | }, 339 | { 340 | "name": "id", 341 | "in": "path", 342 | "description": "", 343 | "deprecated": false, 344 | "required": true, 345 | "schema": { 346 | "type": "string" 347 | } 348 | } 349 | ] 350 | }, 351 | "delete": { 352 | "deprecated": false, 353 | "description": "Delete a record", 354 | "responses": { 355 | "200": { 356 | "description": "deletes a single record based on the ID supplied", 357 | "content": { 358 | "application/json": { 359 | "schema": { 360 | "type": "integer", 361 | "format": "int64" 362 | } 363 | } 364 | } 365 | }, 366 | "403": { 367 | "description": "Forbidden", 368 | "content": { 369 | "application/json": { 370 | "schema": { 371 | "$ref": "#/components/schemas/Error" 372 | } 373 | } 374 | } 375 | }, 376 | "404": { 377 | "description": "Not found", 378 | "content": { 379 | "application/json": { 380 | "schema": { 381 | "$ref": "#/components/schemas/Error" 382 | } 383 | } 384 | } 385 | }, 386 | "default": { 387 | "description": "unexpected error", 388 | "content": { 389 | "application/json": { 390 | "schema": { 391 | "$ref": "#/components/schemas/Error" 392 | } 393 | } 394 | } 395 | } 396 | }, 397 | "summary": "", 398 | "tags": [ 399 | "Comment" 400 | ], 401 | "parameters": [ 402 | { 403 | "name": "articleId", 404 | "in": "path", 405 | "description": "", 406 | "deprecated": false, 407 | "required": true, 408 | "schema": { 409 | "type": "string" 410 | } 411 | }, 412 | { 413 | "name": "id", 414 | "in": "path", 415 | "description": "", 416 | "deprecated": false, 417 | "required": true, 418 | "schema": { 419 | "type": "string" 420 | } 421 | } 422 | ] 423 | } 424 | } 425 | }, 426 | "components": { 427 | "schemas": { 428 | "Comment": { 429 | "required": [ 430 | "id" 431 | ], 432 | "properties": { 433 | "id": { 434 | "type": "string" 435 | }, 436 | "message": { 437 | "type": "string" 438 | }, 439 | "user": { 440 | "required": [ 441 | "id", 442 | "username", 443 | "email" 444 | ], 445 | "properties": { 446 | "id": { 447 | "type": "string" 448 | }, 449 | "username": { 450 | "type": "string" 451 | }, 452 | "email": { 453 | "type": "string" 454 | }, 455 | "provider": { 456 | "type": "string" 457 | }, 458 | "password": { 459 | "type": "string" 460 | }, 461 | "resetPasswordToken": { 462 | "type": "string" 463 | }, 464 | "confirmationToken": { 465 | "type": "string" 466 | }, 467 | "confirmed": { 468 | "type": "boolean" 469 | }, 470 | "blocked": { 471 | "type": "boolean" 472 | }, 473 | "role": { 474 | "type": "string" 475 | }, 476 | "created_by": { 477 | "type": "string" 478 | }, 479 | "updated_by": { 480 | "type": "string" 481 | } 482 | } 483 | }, 484 | "published_at": { 485 | "type": "string", 486 | "format": "date-time" 487 | } 488 | } 489 | }, 490 | "NewComment": { 491 | "properties": { 492 | "message": { 493 | "type": "string" 494 | }, 495 | "user": { 496 | "type": "string" 497 | }, 498 | "article": { 499 | "type": "string" 500 | }, 501 | "published_at": { 502 | "type": "string", 503 | "format": "date-time" 504 | }, 505 | "created_by": { 506 | "type": "string" 507 | }, 508 | "updated_by": { 509 | "type": "string" 510 | } 511 | } 512 | } 513 | } 514 | }, 515 | "tags": [ 516 | { 517 | "name": "Comment" 518 | } 519 | ] 520 | } -------------------------------------------------------------------------------- /api/comment/models/comment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#lifecycle-hooks) 5 | * to customize this model 6 | */ 7 | 8 | module.exports = {}; 9 | -------------------------------------------------------------------------------- /api/comment/models/comment.settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "collectionType", 3 | "collectionName": "comments", 4 | "info": { 5 | "name": "Comment", 6 | "description": "" 7 | }, 8 | "options": { 9 | "increments": true, 10 | "timestamps": true, 11 | "draftAndPublish": true 12 | }, 13 | "attributes": { 14 | "message": { 15 | "type": "text" 16 | }, 17 | "user": { 18 | "plugin": "users-permissions", 19 | "model": "user" 20 | }, 21 | "article": { 22 | "private": true, 23 | "model": "article", 24 | "via": "comments" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /api/comment/services/comment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-services) 5 | * to customize this service 6 | */ 7 | 8 | module.exports = {}; 9 | -------------------------------------------------------------------------------- /config/database.js: -------------------------------------------------------------------------------- 1 | module.exports = ({ env }) => ({ 2 | defaultConnection: 'default', 3 | connections: { 4 | default: { 5 | connector: 'bookshelf', 6 | settings: { 7 | client: 'sqlite', 8 | filename: env('DATABASE_FILENAME', '.tmp/data.db'), 9 | }, 10 | options: { 11 | useNullAsDefault: true, 12 | }, 13 | }, 14 | }, 15 | }); 16 | -------------------------------------------------------------------------------- /config/functions/bootstrap.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * An asynchronous bootstrap function that runs before 5 | * your application gets started. 6 | * 7 | * This gives you an opportunity to set up your data model, 8 | * run jobs, or perform some special logic. 9 | * 10 | * See more details here: https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#bootstrap 11 | */ 12 | 13 | module.exports = () => {}; 14 | -------------------------------------------------------------------------------- /config/functions/cron.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Cron config that gives you an opportunity 5 | * to run scheduled jobs. 6 | * 7 | * The cron format consists of: 8 | * [SECOND (optional)] [MINUTE] [HOUR] [DAY OF MONTH] [MONTH OF YEAR] [DAY OF WEEK] 9 | * 10 | * See more details here: https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#cron-tasks 11 | */ 12 | 13 | module.exports = { 14 | /** 15 | * Simple example. 16 | * Every monday at 1am. 17 | */ 18 | // '0 1 * * 1': () => { 19 | // 20 | // } 21 | }; 22 | -------------------------------------------------------------------------------- /config/functions/responses/404.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = async (/* ctx */) => { 4 | // return ctx.notFound('My custom message 404'); 5 | }; 6 | -------------------------------------------------------------------------------- /config/server.js: -------------------------------------------------------------------------------- 1 | module.exports = ({ env }) => ({ 2 | host: env('HOST', '0.0.0.0'), 3 | port: env.int('PORT', 1337), 4 | admin: { 5 | auth: { 6 | secret: env('ADMIN_JWT_SECRET', 'c49939c2901c4cf1395e00e5ec470a2b'), 7 | }, 8 | }, 9 | }); 10 | -------------------------------------------------------------------------------- /extensions/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velopert/articles-server/62d24dfb7c2242ca1204fa404e2b370332510cbf/extensions/.gitkeep -------------------------------------------------------------------------------- /extensions/email/documentation/1.0.0/email-Email.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": { 3 | "/email/": { 4 | "post": { 5 | "deprecated": false, 6 | "description": "Send an email", 7 | "responses": { 8 | "200": { 9 | "description": "response", 10 | "content": { 11 | "application/json": { 12 | "schema": { 13 | "properties": { 14 | "foo": { 15 | "type": "string" 16 | } 17 | } 18 | } 19 | } 20 | } 21 | }, 22 | "403": { 23 | "description": "Forbidden", 24 | "content": { 25 | "application/json": { 26 | "schema": { 27 | "$ref": "#/components/schemas/Error" 28 | } 29 | } 30 | } 31 | }, 32 | "404": { 33 | "description": "Not found", 34 | "content": { 35 | "application/json": { 36 | "schema": { 37 | "$ref": "#/components/schemas/Error" 38 | } 39 | } 40 | } 41 | }, 42 | "default": { 43 | "description": "unexpected error", 44 | "content": { 45 | "application/json": { 46 | "schema": { 47 | "$ref": "#/components/schemas/Error" 48 | } 49 | } 50 | } 51 | } 52 | }, 53 | "summary": "", 54 | "tags": [ 55 | "Email - Email" 56 | ], 57 | "requestBody": { 58 | "description": "", 59 | "required": true, 60 | "content": { 61 | "application/json": { 62 | "schema": { 63 | "properties": { 64 | "foo": { 65 | "type": "string" 66 | } 67 | } 68 | } 69 | } 70 | } 71 | } 72 | } 73 | }, 74 | "/email/test": { 75 | "post": { 76 | "deprecated": false, 77 | "description": "Send an test email", 78 | "responses": { 79 | "200": { 80 | "description": "response", 81 | "content": { 82 | "application/json": { 83 | "schema": { 84 | "properties": { 85 | "foo": { 86 | "type": "string" 87 | } 88 | } 89 | } 90 | } 91 | } 92 | }, 93 | "403": { 94 | "description": "Forbidden", 95 | "content": { 96 | "application/json": { 97 | "schema": { 98 | "$ref": "#/components/schemas/Error" 99 | } 100 | } 101 | } 102 | }, 103 | "404": { 104 | "description": "Not found", 105 | "content": { 106 | "application/json": { 107 | "schema": { 108 | "$ref": "#/components/schemas/Error" 109 | } 110 | } 111 | } 112 | }, 113 | "default": { 114 | "description": "unexpected error", 115 | "content": { 116 | "application/json": { 117 | "schema": { 118 | "$ref": "#/components/schemas/Error" 119 | } 120 | } 121 | } 122 | } 123 | }, 124 | "summary": "", 125 | "tags": [ 126 | "Email - Email" 127 | ], 128 | "requestBody": { 129 | "description": "", 130 | "required": true, 131 | "content": { 132 | "application/json": { 133 | "schema": { 134 | "properties": { 135 | "foo": { 136 | "type": "string" 137 | } 138 | } 139 | } 140 | } 141 | } 142 | } 143 | } 144 | }, 145 | "/email/settings": { 146 | "get": { 147 | "deprecated": false, 148 | "description": "Get the email settings", 149 | "responses": { 150 | "200": { 151 | "description": "response", 152 | "content": { 153 | "application/json": { 154 | "schema": { 155 | "properties": { 156 | "foo": { 157 | "type": "string" 158 | } 159 | } 160 | } 161 | } 162 | } 163 | }, 164 | "403": { 165 | "description": "Forbidden", 166 | "content": { 167 | "application/json": { 168 | "schema": { 169 | "$ref": "#/components/schemas/Error" 170 | } 171 | } 172 | } 173 | }, 174 | "404": { 175 | "description": "Not found", 176 | "content": { 177 | "application/json": { 178 | "schema": { 179 | "$ref": "#/components/schemas/Error" 180 | } 181 | } 182 | } 183 | }, 184 | "default": { 185 | "description": "unexpected error", 186 | "content": { 187 | "application/json": { 188 | "schema": { 189 | "$ref": "#/components/schemas/Error" 190 | } 191 | } 192 | } 193 | } 194 | }, 195 | "summary": "", 196 | "tags": [ 197 | "Email - Email" 198 | ], 199 | "parameters": [] 200 | } 201 | } 202 | }, 203 | "tags": [ 204 | { 205 | "name": "Email - Email" 206 | } 207 | ] 208 | } -------------------------------------------------------------------------------- /extensions/upload/documentation/1.0.0/upload-File.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": { 3 | "/upload/": { 4 | "post": { 5 | "deprecated": false, 6 | "description": "Upload a file", 7 | "responses": { 8 | "200": { 9 | "description": "response", 10 | "content": { 11 | "application/json": { 12 | "schema": { 13 | "properties": { 14 | "foo": { 15 | "type": "string" 16 | } 17 | } 18 | } 19 | } 20 | } 21 | }, 22 | "403": { 23 | "description": "Forbidden", 24 | "content": { 25 | "application/json": { 26 | "schema": { 27 | "$ref": "#/components/schemas/Error" 28 | } 29 | } 30 | } 31 | }, 32 | "404": { 33 | "description": "Not found", 34 | "content": { 35 | "application/json": { 36 | "schema": { 37 | "$ref": "#/components/schemas/Error" 38 | } 39 | } 40 | } 41 | }, 42 | "default": { 43 | "description": "unexpected error", 44 | "content": { 45 | "application/json": { 46 | "schema": { 47 | "$ref": "#/components/schemas/Error" 48 | } 49 | } 50 | } 51 | } 52 | }, 53 | "summary": "", 54 | "tags": [ 55 | "Upload - File" 56 | ], 57 | "requestBody": { 58 | "description": "", 59 | "required": true, 60 | "content": { 61 | "application/json": { 62 | "schema": { 63 | "properties": { 64 | "foo": { 65 | "type": "string" 66 | } 67 | } 68 | } 69 | } 70 | } 71 | } 72 | } 73 | }, 74 | "/upload/files/count": { 75 | "get": { 76 | "deprecated": false, 77 | "description": "Retrieve the total number of uploaded files", 78 | "responses": { 79 | "200": { 80 | "description": "response", 81 | "content": { 82 | "application/json": { 83 | "schema": { 84 | "properties": { 85 | "foo": { 86 | "type": "string" 87 | } 88 | } 89 | } 90 | } 91 | } 92 | }, 93 | "403": { 94 | "description": "Forbidden", 95 | "content": { 96 | "application/json": { 97 | "schema": { 98 | "$ref": "#/components/schemas/Error" 99 | } 100 | } 101 | } 102 | }, 103 | "404": { 104 | "description": "Not found", 105 | "content": { 106 | "application/json": { 107 | "schema": { 108 | "$ref": "#/components/schemas/Error" 109 | } 110 | } 111 | } 112 | }, 113 | "default": { 114 | "description": "unexpected error", 115 | "content": { 116 | "application/json": { 117 | "schema": { 118 | "$ref": "#/components/schemas/Error" 119 | } 120 | } 121 | } 122 | } 123 | }, 124 | "summary": "", 125 | "tags": [ 126 | "Upload - File" 127 | ], 128 | "parameters": [] 129 | } 130 | }, 131 | "/upload/files": { 132 | "get": { 133 | "deprecated": false, 134 | "description": "Retrieve all file documents", 135 | "responses": { 136 | "200": { 137 | "description": "response", 138 | "content": { 139 | "application/json": { 140 | "schema": { 141 | "properties": { 142 | "foo": { 143 | "type": "string" 144 | } 145 | } 146 | } 147 | } 148 | } 149 | }, 150 | "403": { 151 | "description": "Forbidden", 152 | "content": { 153 | "application/json": { 154 | "schema": { 155 | "$ref": "#/components/schemas/Error" 156 | } 157 | } 158 | } 159 | }, 160 | "404": { 161 | "description": "Not found", 162 | "content": { 163 | "application/json": { 164 | "schema": { 165 | "$ref": "#/components/schemas/Error" 166 | } 167 | } 168 | } 169 | }, 170 | "default": { 171 | "description": "unexpected error", 172 | "content": { 173 | "application/json": { 174 | "schema": { 175 | "$ref": "#/components/schemas/Error" 176 | } 177 | } 178 | } 179 | } 180 | }, 181 | "summary": "", 182 | "tags": [ 183 | "Upload - File" 184 | ], 185 | "parameters": [] 186 | } 187 | }, 188 | "/upload/files/{id}": { 189 | "get": { 190 | "deprecated": false, 191 | "description": "Retrieve a single file depending on its id", 192 | "responses": { 193 | "200": { 194 | "description": "response", 195 | "content": { 196 | "application/json": { 197 | "schema": { 198 | "properties": { 199 | "foo": { 200 | "type": "string" 201 | } 202 | } 203 | } 204 | } 205 | } 206 | }, 207 | "403": { 208 | "description": "Forbidden", 209 | "content": { 210 | "application/json": { 211 | "schema": { 212 | "$ref": "#/components/schemas/Error" 213 | } 214 | } 215 | } 216 | }, 217 | "404": { 218 | "description": "Not found", 219 | "content": { 220 | "application/json": { 221 | "schema": { 222 | "$ref": "#/components/schemas/Error" 223 | } 224 | } 225 | } 226 | }, 227 | "default": { 228 | "description": "unexpected error", 229 | "content": { 230 | "application/json": { 231 | "schema": { 232 | "$ref": "#/components/schemas/Error" 233 | } 234 | } 235 | } 236 | } 237 | }, 238 | "summary": "", 239 | "tags": [ 240 | "Upload - File" 241 | ], 242 | "parameters": [ 243 | { 244 | "name": "id", 245 | "in": "path", 246 | "description": "", 247 | "deprecated": false, 248 | "required": true, 249 | "schema": { 250 | "type": "string" 251 | } 252 | } 253 | ] 254 | }, 255 | "delete": { 256 | "deprecated": false, 257 | "description": "Delete an uploaded file", 258 | "responses": { 259 | "200": { 260 | "description": "response", 261 | "content": { 262 | "application/json": { 263 | "schema": { 264 | "properties": { 265 | "foo": { 266 | "type": "string" 267 | } 268 | } 269 | } 270 | } 271 | } 272 | }, 273 | "403": { 274 | "description": "Forbidden", 275 | "content": { 276 | "application/json": { 277 | "schema": { 278 | "$ref": "#/components/schemas/Error" 279 | } 280 | } 281 | } 282 | }, 283 | "404": { 284 | "description": "Not found", 285 | "content": { 286 | "application/json": { 287 | "schema": { 288 | "$ref": "#/components/schemas/Error" 289 | } 290 | } 291 | } 292 | }, 293 | "default": { 294 | "description": "unexpected error", 295 | "content": { 296 | "application/json": { 297 | "schema": { 298 | "$ref": "#/components/schemas/Error" 299 | } 300 | } 301 | } 302 | } 303 | }, 304 | "summary": "", 305 | "tags": [ 306 | "Upload - File" 307 | ], 308 | "parameters": [ 309 | { 310 | "name": "id", 311 | "in": "path", 312 | "description": "", 313 | "deprecated": false, 314 | "required": true, 315 | "schema": { 316 | "type": "string" 317 | } 318 | } 319 | ] 320 | } 321 | }, 322 | "/upload/search/{id}": { 323 | "get": { 324 | "deprecated": false, 325 | "description": "Search for an uploaded file", 326 | "responses": { 327 | "200": { 328 | "description": "response", 329 | "content": { 330 | "application/json": { 331 | "schema": { 332 | "properties": { 333 | "foo": { 334 | "type": "string" 335 | } 336 | } 337 | } 338 | } 339 | } 340 | }, 341 | "403": { 342 | "description": "Forbidden", 343 | "content": { 344 | "application/json": { 345 | "schema": { 346 | "$ref": "#/components/schemas/Error" 347 | } 348 | } 349 | } 350 | }, 351 | "404": { 352 | "description": "Not found", 353 | "content": { 354 | "application/json": { 355 | "schema": { 356 | "$ref": "#/components/schemas/Error" 357 | } 358 | } 359 | } 360 | }, 361 | "default": { 362 | "description": "unexpected error", 363 | "content": { 364 | "application/json": { 365 | "schema": { 366 | "$ref": "#/components/schemas/Error" 367 | } 368 | } 369 | } 370 | } 371 | }, 372 | "summary": "", 373 | "tags": [ 374 | "Upload - File" 375 | ], 376 | "parameters": [ 377 | { 378 | "name": "id", 379 | "in": "path", 380 | "description": "", 381 | "deprecated": false, 382 | "required": true, 383 | "schema": { 384 | "type": "string" 385 | } 386 | } 387 | ] 388 | } 389 | } 390 | }, 391 | "tags": [ 392 | { 393 | "name": "Upload - File" 394 | } 395 | ] 396 | } -------------------------------------------------------------------------------- /extensions/users-permissions/config/jwt.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | jwtSecret: process.env.JWT_SECRET || '1837e85b-2f46-4b5d-a172-4e1800966ee8' 3 | }; -------------------------------------------------------------------------------- /extensions/users-permissions/documentation/1.0.0/users-permissions-Role.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": { 3 | "/users-permissions/roles/{id}": { 4 | "get": { 5 | "deprecated": false, 6 | "description": "Retrieve a role depending on its id", 7 | "responses": { 8 | "200": { 9 | "description": "response", 10 | "content": { 11 | "application/json": { 12 | "schema": { 13 | "$ref": "#/components/schemas/UsersPermissionsRole" 14 | } 15 | } 16 | } 17 | }, 18 | "403": { 19 | "description": "Forbidden", 20 | "content": { 21 | "application/json": { 22 | "schema": { 23 | "$ref": "#/components/schemas/Error" 24 | } 25 | } 26 | } 27 | }, 28 | "404": { 29 | "description": "Not found", 30 | "content": { 31 | "application/json": { 32 | "schema": { 33 | "$ref": "#/components/schemas/Error" 34 | } 35 | } 36 | } 37 | }, 38 | "default": { 39 | "description": "unexpected error", 40 | "content": { 41 | "application/json": { 42 | "schema": { 43 | "$ref": "#/components/schemas/Error" 44 | } 45 | } 46 | } 47 | } 48 | }, 49 | "summary": "", 50 | "tags": [ 51 | "UsersPermissions - Role" 52 | ], 53 | "parameters": [ 54 | { 55 | "name": "id", 56 | "in": "path", 57 | "description": "", 58 | "deprecated": false, 59 | "required": true, 60 | "schema": { 61 | "type": "string" 62 | } 63 | } 64 | ] 65 | } 66 | }, 67 | "/users-permissions/roles": { 68 | "get": { 69 | "deprecated": false, 70 | "description": "Retrieve all role documents", 71 | "responses": { 72 | "200": { 73 | "description": "response", 74 | "content": { 75 | "application/json": { 76 | "schema": { 77 | "type": "array", 78 | "items": { 79 | "$ref": "#/components/schemas/UsersPermissionsRole" 80 | } 81 | } 82 | } 83 | } 84 | }, 85 | "403": { 86 | "description": "Forbidden", 87 | "content": { 88 | "application/json": { 89 | "schema": { 90 | "$ref": "#/components/schemas/Error" 91 | } 92 | } 93 | } 94 | }, 95 | "404": { 96 | "description": "Not found", 97 | "content": { 98 | "application/json": { 99 | "schema": { 100 | "$ref": "#/components/schemas/Error" 101 | } 102 | } 103 | } 104 | }, 105 | "default": { 106 | "description": "unexpected error", 107 | "content": { 108 | "application/json": { 109 | "schema": { 110 | "$ref": "#/components/schemas/Error" 111 | } 112 | } 113 | } 114 | } 115 | }, 116 | "summary": "", 117 | "tags": [ 118 | "UsersPermissions - Role" 119 | ], 120 | "parameters": [ 121 | { 122 | "name": "_limit", 123 | "in": "query", 124 | "required": false, 125 | "description": "Maximum number of results possible", 126 | "schema": { 127 | "type": "integer" 128 | }, 129 | "deprecated": false 130 | }, 131 | { 132 | "name": "_sort", 133 | "in": "query", 134 | "required": false, 135 | "description": "Sort according to a specific field.", 136 | "schema": { 137 | "type": "string" 138 | }, 139 | "deprecated": false 140 | }, 141 | { 142 | "name": "_start", 143 | "in": "query", 144 | "required": false, 145 | "description": "Skip a specific number of entries (especially useful for pagination)", 146 | "schema": { 147 | "type": "integer" 148 | }, 149 | "deprecated": false 150 | }, 151 | { 152 | "name": "=", 153 | "in": "query", 154 | "required": false, 155 | "description": "Get entries that matches exactly your input", 156 | "schema": { 157 | "type": "string" 158 | }, 159 | "deprecated": false 160 | }, 161 | { 162 | "name": "_ne", 163 | "in": "query", 164 | "required": false, 165 | "description": "Get records that are not equals to something", 166 | "schema": { 167 | "type": "string" 168 | }, 169 | "deprecated": false 170 | }, 171 | { 172 | "name": "_lt", 173 | "in": "query", 174 | "required": false, 175 | "description": "Get record that are lower than a value", 176 | "schema": { 177 | "type": "string" 178 | }, 179 | "deprecated": false 180 | }, 181 | { 182 | "name": "_lte", 183 | "in": "query", 184 | "required": false, 185 | "description": "Get records that are lower than or equal to a value", 186 | "schema": { 187 | "type": "string" 188 | }, 189 | "deprecated": false 190 | }, 191 | { 192 | "name": "_gt", 193 | "in": "query", 194 | "required": false, 195 | "description": "Get records that are greater than a value", 196 | "schema": { 197 | "type": "string" 198 | }, 199 | "deprecated": false 200 | }, 201 | { 202 | "name": "_gte", 203 | "in": "query", 204 | "required": false, 205 | "description": "Get records that are greater than or equal a value", 206 | "schema": { 207 | "type": "string" 208 | }, 209 | "deprecated": false 210 | }, 211 | { 212 | "name": "_contains", 213 | "in": "query", 214 | "required": false, 215 | "description": "Get records that contains a value", 216 | "schema": { 217 | "type": "string" 218 | }, 219 | "deprecated": false 220 | }, 221 | { 222 | "name": "_containss", 223 | "in": "query", 224 | "required": false, 225 | "description": "Get records that contains (case sensitive) a value", 226 | "schema": { 227 | "type": "string" 228 | }, 229 | "deprecated": false 230 | }, 231 | { 232 | "name": "_in", 233 | "in": "query", 234 | "required": false, 235 | "description": "Get records that matches any value in the array of values", 236 | "schema": { 237 | "type": "array", 238 | "items": { 239 | "type": "string" 240 | } 241 | }, 242 | "deprecated": false 243 | }, 244 | { 245 | "name": "_nin", 246 | "in": "query", 247 | "required": false, 248 | "description": "Get records that doesn't match any value in the array of values", 249 | "schema": { 250 | "type": "array", 251 | "items": { 252 | "type": "string" 253 | } 254 | }, 255 | "deprecated": false 256 | } 257 | ] 258 | }, 259 | "post": { 260 | "deprecated": false, 261 | "description": "Create a new role", 262 | "responses": { 263 | "200": { 264 | "description": "response", 265 | "content": { 266 | "application/json": { 267 | "schema": { 268 | "$ref": "#/components/schemas/UsersPermissionsRole" 269 | } 270 | } 271 | } 272 | }, 273 | "403": { 274 | "description": "Forbidden", 275 | "content": { 276 | "application/json": { 277 | "schema": { 278 | "$ref": "#/components/schemas/Error" 279 | } 280 | } 281 | } 282 | }, 283 | "404": { 284 | "description": "Not found", 285 | "content": { 286 | "application/json": { 287 | "schema": { 288 | "$ref": "#/components/schemas/Error" 289 | } 290 | } 291 | } 292 | }, 293 | "default": { 294 | "description": "unexpected error", 295 | "content": { 296 | "application/json": { 297 | "schema": { 298 | "$ref": "#/components/schemas/Error" 299 | } 300 | } 301 | } 302 | } 303 | }, 304 | "summary": "", 305 | "tags": [ 306 | "UsersPermissions - Role" 307 | ], 308 | "requestBody": { 309 | "description": "", 310 | "required": true, 311 | "content": { 312 | "application/json": { 313 | "schema": { 314 | "$ref": "#/components/schemas/NewUsersPermissionsRole" 315 | } 316 | } 317 | } 318 | } 319 | } 320 | }, 321 | "/users-permissions/roles/{role}": { 322 | "put": { 323 | "deprecated": false, 324 | "description": "Update a role", 325 | "responses": { 326 | "200": { 327 | "description": "response", 328 | "content": { 329 | "application/json": { 330 | "schema": { 331 | "$ref": "#/components/schemas/UsersPermissionsRole" 332 | } 333 | } 334 | } 335 | }, 336 | "403": { 337 | "description": "Forbidden", 338 | "content": { 339 | "application/json": { 340 | "schema": { 341 | "$ref": "#/components/schemas/Error" 342 | } 343 | } 344 | } 345 | }, 346 | "404": { 347 | "description": "Not found", 348 | "content": { 349 | "application/json": { 350 | "schema": { 351 | "$ref": "#/components/schemas/Error" 352 | } 353 | } 354 | } 355 | }, 356 | "default": { 357 | "description": "unexpected error", 358 | "content": { 359 | "application/json": { 360 | "schema": { 361 | "$ref": "#/components/schemas/Error" 362 | } 363 | } 364 | } 365 | } 366 | }, 367 | "summary": "", 368 | "tags": [ 369 | "UsersPermissions - Role" 370 | ], 371 | "parameters": [ 372 | { 373 | "name": "role", 374 | "in": "path", 375 | "description": "", 376 | "deprecated": false, 377 | "required": true, 378 | "schema": { 379 | "type": "string" 380 | } 381 | } 382 | ], 383 | "requestBody": { 384 | "description": "", 385 | "required": true, 386 | "content": { 387 | "application/json": { 388 | "schema": { 389 | "$ref": "#/components/schemas/NewUsersPermissionsRole" 390 | } 391 | } 392 | } 393 | } 394 | }, 395 | "delete": { 396 | "deprecated": false, 397 | "description": "Delete a role", 398 | "responses": { 399 | "200": { 400 | "description": "response", 401 | "content": { 402 | "application/json": { 403 | "schema": { 404 | "properties": { 405 | "foo": { 406 | "type": "string" 407 | } 408 | } 409 | } 410 | } 411 | } 412 | }, 413 | "403": { 414 | "description": "Forbidden", 415 | "content": { 416 | "application/json": { 417 | "schema": { 418 | "$ref": "#/components/schemas/Error" 419 | } 420 | } 421 | } 422 | }, 423 | "404": { 424 | "description": "Not found", 425 | "content": { 426 | "application/json": { 427 | "schema": { 428 | "$ref": "#/components/schemas/Error" 429 | } 430 | } 431 | } 432 | }, 433 | "default": { 434 | "description": "unexpected error", 435 | "content": { 436 | "application/json": { 437 | "schema": { 438 | "$ref": "#/components/schemas/Error" 439 | } 440 | } 441 | } 442 | } 443 | }, 444 | "summary": "", 445 | "tags": [ 446 | "UsersPermissions - Role" 447 | ], 448 | "parameters": [ 449 | { 450 | "name": "role", 451 | "in": "path", 452 | "description": "", 453 | "deprecated": false, 454 | "required": true, 455 | "schema": { 456 | "type": "string" 457 | } 458 | } 459 | ] 460 | } 461 | } 462 | }, 463 | "components": { 464 | "schemas": { 465 | "UsersPermissionsRole": { 466 | "required": [ 467 | "id", 468 | "name" 469 | ], 470 | "properties": { 471 | "id": { 472 | "type": "string" 473 | }, 474 | "name": { 475 | "type": "string", 476 | "minLength": 3 477 | }, 478 | "description": { 479 | "type": "string" 480 | }, 481 | "type": { 482 | "type": "string" 483 | }, 484 | "permissions": { 485 | "type": "array", 486 | "items": { 487 | "required": [ 488 | "id", 489 | "type", 490 | "controller", 491 | "action", 492 | "enabled" 493 | ], 494 | "properties": { 495 | "id": { 496 | "type": "string" 497 | }, 498 | "type": { 499 | "type": "string" 500 | }, 501 | "controller": { 502 | "type": "string" 503 | }, 504 | "action": { 505 | "type": "string" 506 | }, 507 | "enabled": { 508 | "type": "boolean" 509 | }, 510 | "policy": { 511 | "type": "string" 512 | }, 513 | "role": { 514 | "type": "string" 515 | }, 516 | "created_by": { 517 | "type": "string" 518 | }, 519 | "updated_by": { 520 | "type": "string" 521 | } 522 | } 523 | } 524 | }, 525 | "users": { 526 | "type": "array", 527 | "items": { 528 | "required": [ 529 | "id", 530 | "username", 531 | "email" 532 | ], 533 | "properties": { 534 | "id": { 535 | "type": "string" 536 | }, 537 | "username": { 538 | "type": "string" 539 | }, 540 | "email": { 541 | "type": "string" 542 | }, 543 | "provider": { 544 | "type": "string" 545 | }, 546 | "password": { 547 | "type": "string" 548 | }, 549 | "resetPasswordToken": { 550 | "type": "string" 551 | }, 552 | "confirmationToken": { 553 | "type": "string" 554 | }, 555 | "confirmed": { 556 | "type": "boolean" 557 | }, 558 | "blocked": { 559 | "type": "boolean" 560 | }, 561 | "role": { 562 | "type": "string" 563 | }, 564 | "created_by": { 565 | "type": "string" 566 | }, 567 | "updated_by": { 568 | "type": "string" 569 | } 570 | } 571 | } 572 | } 573 | } 574 | }, 575 | "NewUsersPermissionsRole": { 576 | "required": [ 577 | "name" 578 | ], 579 | "properties": { 580 | "name": { 581 | "type": "string", 582 | "minLength": 3 583 | }, 584 | "description": { 585 | "type": "string" 586 | }, 587 | "type": { 588 | "type": "string" 589 | }, 590 | "permissions": { 591 | "type": "array", 592 | "items": { 593 | "type": "string" 594 | } 595 | }, 596 | "users": { 597 | "type": "array", 598 | "items": { 599 | "type": "string" 600 | } 601 | }, 602 | "created_by": { 603 | "type": "string" 604 | }, 605 | "updated_by": { 606 | "type": "string" 607 | } 608 | } 609 | } 610 | } 611 | }, 612 | "tags": [ 613 | { 614 | "name": "UsersPermissions - Role" 615 | } 616 | ] 617 | } -------------------------------------------------------------------------------- /extensions/users-permissions/documentation/1.0.0/users-permissions-User.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": { 3 | "/users-permissions/search/{id}": { 4 | "get": { 5 | "deprecated": false, 6 | "description": "Search for users", 7 | "responses": { 8 | "200": { 9 | "description": "response", 10 | "content": { 11 | "application/json": { 12 | "schema": { 13 | "type": "array", 14 | "items": { 15 | "$ref": "#/components/schemas/UsersPermissionsUser" 16 | } 17 | } 18 | } 19 | } 20 | }, 21 | "403": { 22 | "description": "Forbidden", 23 | "content": { 24 | "application/json": { 25 | "schema": { 26 | "$ref": "#/components/schemas/Error" 27 | } 28 | } 29 | } 30 | }, 31 | "404": { 32 | "description": "Not found", 33 | "content": { 34 | "application/json": { 35 | "schema": { 36 | "$ref": "#/components/schemas/Error" 37 | } 38 | } 39 | } 40 | }, 41 | "default": { 42 | "description": "unexpected error", 43 | "content": { 44 | "application/json": { 45 | "schema": { 46 | "$ref": "#/components/schemas/Error" 47 | } 48 | } 49 | } 50 | } 51 | }, 52 | "summary": "", 53 | "tags": [ 54 | "UsersPermissions - User" 55 | ], 56 | "parameters": [ 57 | { 58 | "name": "id", 59 | "in": "path", 60 | "description": "", 61 | "deprecated": false, 62 | "required": true, 63 | "schema": { 64 | "type": "string" 65 | } 66 | }, 67 | { 68 | "name": "_limit", 69 | "in": "query", 70 | "required": false, 71 | "description": "Maximum number of results possible", 72 | "schema": { 73 | "type": "integer" 74 | }, 75 | "deprecated": false 76 | }, 77 | { 78 | "name": "_sort", 79 | "in": "query", 80 | "required": false, 81 | "description": "Sort according to a specific field.", 82 | "schema": { 83 | "type": "string" 84 | }, 85 | "deprecated": false 86 | }, 87 | { 88 | "name": "_start", 89 | "in": "query", 90 | "required": false, 91 | "description": "Skip a specific number of entries (especially useful for pagination)", 92 | "schema": { 93 | "type": "integer" 94 | }, 95 | "deprecated": false 96 | }, 97 | { 98 | "name": "=", 99 | "in": "query", 100 | "required": false, 101 | "description": "Get entries that matches exactly your input", 102 | "schema": { 103 | "type": "string" 104 | }, 105 | "deprecated": false 106 | }, 107 | { 108 | "name": "_ne", 109 | "in": "query", 110 | "required": false, 111 | "description": "Get records that are not equals to something", 112 | "schema": { 113 | "type": "string" 114 | }, 115 | "deprecated": false 116 | }, 117 | { 118 | "name": "_lt", 119 | "in": "query", 120 | "required": false, 121 | "description": "Get record that are lower than a value", 122 | "schema": { 123 | "type": "string" 124 | }, 125 | "deprecated": false 126 | }, 127 | { 128 | "name": "_lte", 129 | "in": "query", 130 | "required": false, 131 | "description": "Get records that are lower than or equal to a value", 132 | "schema": { 133 | "type": "string" 134 | }, 135 | "deprecated": false 136 | }, 137 | { 138 | "name": "_gt", 139 | "in": "query", 140 | "required": false, 141 | "description": "Get records that are greater than a value", 142 | "schema": { 143 | "type": "string" 144 | }, 145 | "deprecated": false 146 | }, 147 | { 148 | "name": "_gte", 149 | "in": "query", 150 | "required": false, 151 | "description": "Get records that are greater than or equal a value", 152 | "schema": { 153 | "type": "string" 154 | }, 155 | "deprecated": false 156 | }, 157 | { 158 | "name": "_contains", 159 | "in": "query", 160 | "required": false, 161 | "description": "Get records that contains a value", 162 | "schema": { 163 | "type": "string" 164 | }, 165 | "deprecated": false 166 | }, 167 | { 168 | "name": "_containss", 169 | "in": "query", 170 | "required": false, 171 | "description": "Get records that contains (case sensitive) a value", 172 | "schema": { 173 | "type": "string" 174 | }, 175 | "deprecated": false 176 | }, 177 | { 178 | "name": "_in", 179 | "in": "query", 180 | "required": false, 181 | "description": "Get records that matches any value in the array of values", 182 | "schema": { 183 | "type": "array", 184 | "items": { 185 | "type": "string" 186 | } 187 | }, 188 | "deprecated": false 189 | }, 190 | { 191 | "name": "_nin", 192 | "in": "query", 193 | "required": false, 194 | "description": "Get records that doesn't match any value in the array of values", 195 | "schema": { 196 | "type": "array", 197 | "items": { 198 | "type": "string" 199 | } 200 | }, 201 | "deprecated": false 202 | } 203 | ] 204 | } 205 | }, 206 | "/connect/*": { 207 | "get": { 208 | "deprecated": false, 209 | "description": "Connect a provider", 210 | "responses": { 211 | "200": { 212 | "description": "response", 213 | "content": { 214 | "application/json": { 215 | "schema": { 216 | "properties": { 217 | "foo": { 218 | "type": "string" 219 | } 220 | } 221 | } 222 | } 223 | } 224 | }, 225 | "403": { 226 | "description": "Forbidden", 227 | "content": { 228 | "application/json": { 229 | "schema": { 230 | "$ref": "#/components/schemas/Error" 231 | } 232 | } 233 | } 234 | }, 235 | "404": { 236 | "description": "Not found", 237 | "content": { 238 | "application/json": { 239 | "schema": { 240 | "$ref": "#/components/schemas/Error" 241 | } 242 | } 243 | } 244 | }, 245 | "default": { 246 | "description": "unexpected error", 247 | "content": { 248 | "application/json": { 249 | "schema": { 250 | "$ref": "#/components/schemas/Error" 251 | } 252 | } 253 | } 254 | } 255 | }, 256 | "summary": "", 257 | "tags": [ 258 | "UsersPermissions - User" 259 | ], 260 | "parameters": [] 261 | } 262 | }, 263 | "/auth/local": { 264 | "post": { 265 | "deprecated": false, 266 | "description": "Login a user using the identifiers email and password", 267 | "responses": { 268 | "200": { 269 | "description": "response", 270 | "content": { 271 | "application/json": { 272 | "schema": { 273 | "properties": { 274 | "foo": { 275 | "type": "string" 276 | } 277 | } 278 | } 279 | } 280 | } 281 | }, 282 | "403": { 283 | "description": "Forbidden", 284 | "content": { 285 | "application/json": { 286 | "schema": { 287 | "$ref": "#/components/schemas/Error" 288 | } 289 | } 290 | } 291 | }, 292 | "404": { 293 | "description": "Not found", 294 | "content": { 295 | "application/json": { 296 | "schema": { 297 | "$ref": "#/components/schemas/Error" 298 | } 299 | } 300 | } 301 | }, 302 | "default": { 303 | "description": "unexpected error", 304 | "content": { 305 | "application/json": { 306 | "schema": { 307 | "$ref": "#/components/schemas/Error" 308 | } 309 | } 310 | } 311 | } 312 | }, 313 | "summary": "", 314 | "tags": [ 315 | "UsersPermissions - User" 316 | ], 317 | "requestBody": { 318 | "description": "", 319 | "required": true, 320 | "content": { 321 | "application/json": { 322 | "schema": { 323 | "properties": { 324 | "foo": { 325 | "type": "string" 326 | } 327 | } 328 | } 329 | } 330 | } 331 | } 332 | } 333 | }, 334 | "/auth/local/register": { 335 | "post": { 336 | "deprecated": false, 337 | "description": "Register a new user with the default role", 338 | "responses": { 339 | "200": { 340 | "description": "response", 341 | "content": { 342 | "application/json": { 343 | "schema": { 344 | "$ref": "#/components/schemas/UsersPermissionsUser" 345 | } 346 | } 347 | } 348 | }, 349 | "403": { 350 | "description": "Forbidden", 351 | "content": { 352 | "application/json": { 353 | "schema": { 354 | "$ref": "#/components/schemas/Error" 355 | } 356 | } 357 | } 358 | }, 359 | "404": { 360 | "description": "Not found", 361 | "content": { 362 | "application/json": { 363 | "schema": { 364 | "$ref": "#/components/schemas/Error" 365 | } 366 | } 367 | } 368 | }, 369 | "default": { 370 | "description": "unexpected error", 371 | "content": { 372 | "application/json": { 373 | "schema": { 374 | "$ref": "#/components/schemas/Error" 375 | } 376 | } 377 | } 378 | } 379 | }, 380 | "summary": "", 381 | "tags": [ 382 | "UsersPermissions - User" 383 | ], 384 | "requestBody": { 385 | "description": "", 386 | "required": true, 387 | "content": { 388 | "application/json": { 389 | "schema": { 390 | "$ref": "#/components/schemas/NewUsersPermissionsUser" 391 | } 392 | } 393 | } 394 | } 395 | } 396 | }, 397 | "/auth/{provider}/callback": { 398 | "get": { 399 | "deprecated": false, 400 | "description": "Successfull redirection after approving a provider", 401 | "responses": { 402 | "200": { 403 | "description": "response", 404 | "content": { 405 | "application/json": { 406 | "schema": { 407 | "properties": { 408 | "foo": { 409 | "type": "string" 410 | } 411 | } 412 | } 413 | } 414 | } 415 | }, 416 | "403": { 417 | "description": "Forbidden", 418 | "content": { 419 | "application/json": { 420 | "schema": { 421 | "$ref": "#/components/schemas/Error" 422 | } 423 | } 424 | } 425 | }, 426 | "404": { 427 | "description": "Not found", 428 | "content": { 429 | "application/json": { 430 | "schema": { 431 | "$ref": "#/components/schemas/Error" 432 | } 433 | } 434 | } 435 | }, 436 | "default": { 437 | "description": "unexpected error", 438 | "content": { 439 | "application/json": { 440 | "schema": { 441 | "$ref": "#/components/schemas/Error" 442 | } 443 | } 444 | } 445 | } 446 | }, 447 | "summary": "", 448 | "tags": [ 449 | "UsersPermissions - User" 450 | ], 451 | "parameters": [ 452 | { 453 | "name": "provider", 454 | "in": "path", 455 | "description": "", 456 | "deprecated": false, 457 | "required": true, 458 | "schema": { 459 | "type": "string" 460 | } 461 | } 462 | ] 463 | } 464 | }, 465 | "/auth/forgot-password": { 466 | "post": { 467 | "deprecated": false, 468 | "description": "Send the reset password email link", 469 | "responses": { 470 | "200": { 471 | "description": "response", 472 | "content": { 473 | "application/json": { 474 | "schema": { 475 | "properties": { 476 | "foo": { 477 | "type": "string" 478 | } 479 | } 480 | } 481 | } 482 | } 483 | }, 484 | "403": { 485 | "description": "Forbidden", 486 | "content": { 487 | "application/json": { 488 | "schema": { 489 | "$ref": "#/components/schemas/Error" 490 | } 491 | } 492 | } 493 | }, 494 | "404": { 495 | "description": "Not found", 496 | "content": { 497 | "application/json": { 498 | "schema": { 499 | "$ref": "#/components/schemas/Error" 500 | } 501 | } 502 | } 503 | }, 504 | "default": { 505 | "description": "unexpected error", 506 | "content": { 507 | "application/json": { 508 | "schema": { 509 | "$ref": "#/components/schemas/Error" 510 | } 511 | } 512 | } 513 | } 514 | }, 515 | "summary": "", 516 | "tags": [ 517 | "UsersPermissions - User" 518 | ], 519 | "requestBody": { 520 | "description": "", 521 | "required": true, 522 | "content": { 523 | "application/json": { 524 | "schema": { 525 | "properties": { 526 | "foo": { 527 | "type": "string" 528 | } 529 | } 530 | } 531 | } 532 | } 533 | } 534 | } 535 | }, 536 | "/auth/reset-password": { 537 | "post": { 538 | "deprecated": false, 539 | "description": "Reset user password with a code (resetToken)", 540 | "responses": { 541 | "200": { 542 | "description": "response", 543 | "content": { 544 | "application/json": { 545 | "schema": { 546 | "properties": { 547 | "foo": { 548 | "type": "string" 549 | } 550 | } 551 | } 552 | } 553 | } 554 | }, 555 | "403": { 556 | "description": "Forbidden", 557 | "content": { 558 | "application/json": { 559 | "schema": { 560 | "$ref": "#/components/schemas/Error" 561 | } 562 | } 563 | } 564 | }, 565 | "404": { 566 | "description": "Not found", 567 | "content": { 568 | "application/json": { 569 | "schema": { 570 | "$ref": "#/components/schemas/Error" 571 | } 572 | } 573 | } 574 | }, 575 | "default": { 576 | "description": "unexpected error", 577 | "content": { 578 | "application/json": { 579 | "schema": { 580 | "$ref": "#/components/schemas/Error" 581 | } 582 | } 583 | } 584 | } 585 | }, 586 | "summary": "", 587 | "tags": [ 588 | "UsersPermissions - User" 589 | ], 590 | "requestBody": { 591 | "description": "", 592 | "required": true, 593 | "content": { 594 | "application/json": { 595 | "schema": { 596 | "properties": { 597 | "foo": { 598 | "type": "string" 599 | } 600 | } 601 | } 602 | } 603 | } 604 | } 605 | } 606 | }, 607 | "/auth/email-confirmation": { 608 | "get": { 609 | "deprecated": false, 610 | "description": "Validate a user account", 611 | "responses": { 612 | "200": { 613 | "description": "response", 614 | "content": { 615 | "application/json": { 616 | "schema": { 617 | "properties": { 618 | "foo": { 619 | "type": "string" 620 | } 621 | } 622 | } 623 | } 624 | } 625 | }, 626 | "403": { 627 | "description": "Forbidden", 628 | "content": { 629 | "application/json": { 630 | "schema": { 631 | "$ref": "#/components/schemas/Error" 632 | } 633 | } 634 | } 635 | }, 636 | "404": { 637 | "description": "Not found", 638 | "content": { 639 | "application/json": { 640 | "schema": { 641 | "$ref": "#/components/schemas/Error" 642 | } 643 | } 644 | } 645 | }, 646 | "default": { 647 | "description": "unexpected error", 648 | "content": { 649 | "application/json": { 650 | "schema": { 651 | "$ref": "#/components/schemas/Error" 652 | } 653 | } 654 | } 655 | } 656 | }, 657 | "summary": "", 658 | "tags": [ 659 | "UsersPermissions - User" 660 | ], 661 | "parameters": [] 662 | } 663 | }, 664 | "/auth/send-email-confirmation": { 665 | "post": { 666 | "deprecated": false, 667 | "description": "Send a confirmation email to user", 668 | "responses": { 669 | "200": { 670 | "description": "response", 671 | "content": { 672 | "application/json": { 673 | "schema": { 674 | "properties": { 675 | "foo": { 676 | "type": "string" 677 | } 678 | } 679 | } 680 | } 681 | } 682 | }, 683 | "403": { 684 | "description": "Forbidden", 685 | "content": { 686 | "application/json": { 687 | "schema": { 688 | "$ref": "#/components/schemas/Error" 689 | } 690 | } 691 | } 692 | }, 693 | "404": { 694 | "description": "Not found", 695 | "content": { 696 | "application/json": { 697 | "schema": { 698 | "$ref": "#/components/schemas/Error" 699 | } 700 | } 701 | } 702 | }, 703 | "default": { 704 | "description": "unexpected error", 705 | "content": { 706 | "application/json": { 707 | "schema": { 708 | "$ref": "#/components/schemas/Error" 709 | } 710 | } 711 | } 712 | } 713 | }, 714 | "summary": "", 715 | "tags": [ 716 | "UsersPermissions - User" 717 | ], 718 | "requestBody": { 719 | "description": "", 720 | "required": true, 721 | "content": { 722 | "application/json": { 723 | "schema": { 724 | "properties": { 725 | "foo": { 726 | "type": "string" 727 | } 728 | } 729 | } 730 | } 731 | } 732 | } 733 | } 734 | }, 735 | "/users": { 736 | "get": { 737 | "deprecated": false, 738 | "description": "Retrieve all user documents", 739 | "responses": { 740 | "200": { 741 | "description": "response", 742 | "content": { 743 | "application/json": { 744 | "schema": { 745 | "type": "array", 746 | "items": { 747 | "$ref": "#/components/schemas/UsersPermissionsUser" 748 | } 749 | } 750 | } 751 | } 752 | }, 753 | "403": { 754 | "description": "Forbidden", 755 | "content": { 756 | "application/json": { 757 | "schema": { 758 | "$ref": "#/components/schemas/Error" 759 | } 760 | } 761 | } 762 | }, 763 | "404": { 764 | "description": "Not found", 765 | "content": { 766 | "application/json": { 767 | "schema": { 768 | "$ref": "#/components/schemas/Error" 769 | } 770 | } 771 | } 772 | }, 773 | "default": { 774 | "description": "unexpected error", 775 | "content": { 776 | "application/json": { 777 | "schema": { 778 | "$ref": "#/components/schemas/Error" 779 | } 780 | } 781 | } 782 | } 783 | }, 784 | "summary": "", 785 | "tags": [ 786 | "UsersPermissions - User" 787 | ], 788 | "parameters": [ 789 | { 790 | "name": "_limit", 791 | "in": "query", 792 | "required": false, 793 | "description": "Maximum number of results possible", 794 | "schema": { 795 | "type": "integer" 796 | }, 797 | "deprecated": false 798 | }, 799 | { 800 | "name": "_sort", 801 | "in": "query", 802 | "required": false, 803 | "description": "Sort according to a specific field.", 804 | "schema": { 805 | "type": "string" 806 | }, 807 | "deprecated": false 808 | }, 809 | { 810 | "name": "_start", 811 | "in": "query", 812 | "required": false, 813 | "description": "Skip a specific number of entries (especially useful for pagination)", 814 | "schema": { 815 | "type": "integer" 816 | }, 817 | "deprecated": false 818 | }, 819 | { 820 | "name": "=", 821 | "in": "query", 822 | "required": false, 823 | "description": "Get entries that matches exactly your input", 824 | "schema": { 825 | "type": "string" 826 | }, 827 | "deprecated": false 828 | }, 829 | { 830 | "name": "_ne", 831 | "in": "query", 832 | "required": false, 833 | "description": "Get records that are not equals to something", 834 | "schema": { 835 | "type": "string" 836 | }, 837 | "deprecated": false 838 | }, 839 | { 840 | "name": "_lt", 841 | "in": "query", 842 | "required": false, 843 | "description": "Get record that are lower than a value", 844 | "schema": { 845 | "type": "string" 846 | }, 847 | "deprecated": false 848 | }, 849 | { 850 | "name": "_lte", 851 | "in": "query", 852 | "required": false, 853 | "description": "Get records that are lower than or equal to a value", 854 | "schema": { 855 | "type": "string" 856 | }, 857 | "deprecated": false 858 | }, 859 | { 860 | "name": "_gt", 861 | "in": "query", 862 | "required": false, 863 | "description": "Get records that are greater than a value", 864 | "schema": { 865 | "type": "string" 866 | }, 867 | "deprecated": false 868 | }, 869 | { 870 | "name": "_gte", 871 | "in": "query", 872 | "required": false, 873 | "description": "Get records that are greater than or equal a value", 874 | "schema": { 875 | "type": "string" 876 | }, 877 | "deprecated": false 878 | }, 879 | { 880 | "name": "_contains", 881 | "in": "query", 882 | "required": false, 883 | "description": "Get records that contains a value", 884 | "schema": { 885 | "type": "string" 886 | }, 887 | "deprecated": false 888 | }, 889 | { 890 | "name": "_containss", 891 | "in": "query", 892 | "required": false, 893 | "description": "Get records that contains (case sensitive) a value", 894 | "schema": { 895 | "type": "string" 896 | }, 897 | "deprecated": false 898 | }, 899 | { 900 | "name": "_in", 901 | "in": "query", 902 | "required": false, 903 | "description": "Get records that matches any value in the array of values", 904 | "schema": { 905 | "type": "array", 906 | "items": { 907 | "type": "string" 908 | } 909 | }, 910 | "deprecated": false 911 | }, 912 | { 913 | "name": "_nin", 914 | "in": "query", 915 | "required": false, 916 | "description": "Get records that doesn't match any value in the array of values", 917 | "schema": { 918 | "type": "array", 919 | "items": { 920 | "type": "string" 921 | } 922 | }, 923 | "deprecated": false 924 | } 925 | ] 926 | } 927 | }, 928 | "/users/me": { 929 | "get": { 930 | "deprecated": false, 931 | "description": "Retrieve the logged in user information", 932 | "responses": { 933 | "200": { 934 | "description": "response", 935 | "content": { 936 | "application/json": { 937 | "schema": { 938 | "$ref": "#/components/schemas/UsersPermissionsUser" 939 | } 940 | } 941 | } 942 | }, 943 | "403": { 944 | "description": "Forbidden", 945 | "content": { 946 | "application/json": { 947 | "schema": { 948 | "$ref": "#/components/schemas/Error" 949 | } 950 | } 951 | } 952 | }, 953 | "404": { 954 | "description": "Not found", 955 | "content": { 956 | "application/json": { 957 | "schema": { 958 | "$ref": "#/components/schemas/Error" 959 | } 960 | } 961 | } 962 | }, 963 | "default": { 964 | "description": "unexpected error", 965 | "content": { 966 | "application/json": { 967 | "schema": { 968 | "$ref": "#/components/schemas/Error" 969 | } 970 | } 971 | } 972 | } 973 | }, 974 | "summary": "", 975 | "tags": [ 976 | "UsersPermissions - User" 977 | ], 978 | "parameters": [] 979 | } 980 | }, 981 | "/users/{id}": { 982 | "get": { 983 | "deprecated": false, 984 | "description": "Retrieve a single user depending on his id", 985 | "responses": { 986 | "200": { 987 | "description": "response", 988 | "content": { 989 | "application/json": { 990 | "schema": { 991 | "$ref": "#/components/schemas/UsersPermissionsUser" 992 | } 993 | } 994 | } 995 | }, 996 | "403": { 997 | "description": "Forbidden", 998 | "content": { 999 | "application/json": { 1000 | "schema": { 1001 | "$ref": "#/components/schemas/Error" 1002 | } 1003 | } 1004 | } 1005 | }, 1006 | "404": { 1007 | "description": "Not found", 1008 | "content": { 1009 | "application/json": { 1010 | "schema": { 1011 | "$ref": "#/components/schemas/Error" 1012 | } 1013 | } 1014 | } 1015 | }, 1016 | "default": { 1017 | "description": "unexpected error", 1018 | "content": { 1019 | "application/json": { 1020 | "schema": { 1021 | "$ref": "#/components/schemas/Error" 1022 | } 1023 | } 1024 | } 1025 | } 1026 | }, 1027 | "summary": "", 1028 | "tags": [ 1029 | "UsersPermissions - User" 1030 | ], 1031 | "parameters": [ 1032 | { 1033 | "name": "id", 1034 | "in": "path", 1035 | "description": "", 1036 | "deprecated": false, 1037 | "required": true, 1038 | "schema": { 1039 | "type": "string" 1040 | } 1041 | } 1042 | ] 1043 | }, 1044 | "put": { 1045 | "deprecated": false, 1046 | "description": "Update an existing user", 1047 | "responses": { 1048 | "200": { 1049 | "description": "response", 1050 | "content": { 1051 | "application/json": { 1052 | "schema": { 1053 | "$ref": "#/components/schemas/UsersPermissionsUser" 1054 | } 1055 | } 1056 | } 1057 | }, 1058 | "403": { 1059 | "description": "Forbidden", 1060 | "content": { 1061 | "application/json": { 1062 | "schema": { 1063 | "$ref": "#/components/schemas/Error" 1064 | } 1065 | } 1066 | } 1067 | }, 1068 | "404": { 1069 | "description": "Not found", 1070 | "content": { 1071 | "application/json": { 1072 | "schema": { 1073 | "$ref": "#/components/schemas/Error" 1074 | } 1075 | } 1076 | } 1077 | }, 1078 | "default": { 1079 | "description": "unexpected error", 1080 | "content": { 1081 | "application/json": { 1082 | "schema": { 1083 | "$ref": "#/components/schemas/Error" 1084 | } 1085 | } 1086 | } 1087 | } 1088 | }, 1089 | "summary": "", 1090 | "tags": [ 1091 | "UsersPermissions - User" 1092 | ], 1093 | "parameters": [ 1094 | { 1095 | "name": "id", 1096 | "in": "path", 1097 | "description": "", 1098 | "deprecated": false, 1099 | "required": true, 1100 | "schema": { 1101 | "type": "string" 1102 | } 1103 | } 1104 | ], 1105 | "requestBody": { 1106 | "description": "", 1107 | "required": true, 1108 | "content": { 1109 | "application/json": { 1110 | "schema": { 1111 | "$ref": "#/components/schemas/NewUsersPermissionsUser" 1112 | } 1113 | } 1114 | } 1115 | } 1116 | }, 1117 | "delete": { 1118 | "deprecated": false, 1119 | "description": "Delete an existing user", 1120 | "responses": { 1121 | "200": { 1122 | "description": "response", 1123 | "content": { 1124 | "application/json": { 1125 | "schema": { 1126 | "properties": { 1127 | "foo": { 1128 | "type": "string" 1129 | } 1130 | } 1131 | } 1132 | } 1133 | } 1134 | }, 1135 | "403": { 1136 | "description": "Forbidden", 1137 | "content": { 1138 | "application/json": { 1139 | "schema": { 1140 | "$ref": "#/components/schemas/Error" 1141 | } 1142 | } 1143 | } 1144 | }, 1145 | "404": { 1146 | "description": "Not found", 1147 | "content": { 1148 | "application/json": { 1149 | "schema": { 1150 | "$ref": "#/components/schemas/Error" 1151 | } 1152 | } 1153 | } 1154 | }, 1155 | "default": { 1156 | "description": "unexpected error", 1157 | "content": { 1158 | "application/json": { 1159 | "schema": { 1160 | "$ref": "#/components/schemas/Error" 1161 | } 1162 | } 1163 | } 1164 | } 1165 | }, 1166 | "summary": "", 1167 | "tags": [ 1168 | "UsersPermissions - User" 1169 | ], 1170 | "parameters": [ 1171 | { 1172 | "name": "id", 1173 | "in": "path", 1174 | "description": "", 1175 | "deprecated": false, 1176 | "required": true, 1177 | "schema": { 1178 | "type": "string" 1179 | } 1180 | } 1181 | ] 1182 | } 1183 | } 1184 | }, 1185 | "components": { 1186 | "schemas": { 1187 | "UsersPermissionsUser": { 1188 | "required": [ 1189 | "id", 1190 | "username", 1191 | "email" 1192 | ], 1193 | "properties": { 1194 | "id": { 1195 | "type": "string" 1196 | }, 1197 | "username": { 1198 | "type": "string", 1199 | "minLength": 3 1200 | }, 1201 | "email": { 1202 | "type": "string", 1203 | "minLength": 6 1204 | }, 1205 | "provider": { 1206 | "type": "string" 1207 | }, 1208 | "confirmed": { 1209 | "type": "boolean", 1210 | "default": false 1211 | }, 1212 | "blocked": { 1213 | "type": "boolean", 1214 | "default": false 1215 | }, 1216 | "role": { 1217 | "required": [ 1218 | "id", 1219 | "name" 1220 | ], 1221 | "properties": { 1222 | "id": { 1223 | "type": "string" 1224 | }, 1225 | "name": { 1226 | "type": "string" 1227 | }, 1228 | "description": { 1229 | "type": "string" 1230 | }, 1231 | "type": { 1232 | "type": "string" 1233 | }, 1234 | "permissions": { 1235 | "type": "array", 1236 | "items": { 1237 | "type": "string" 1238 | } 1239 | }, 1240 | "users": { 1241 | "type": "array", 1242 | "items": { 1243 | "type": "string" 1244 | } 1245 | }, 1246 | "created_by": { 1247 | "type": "string" 1248 | }, 1249 | "updated_by": { 1250 | "type": "string" 1251 | } 1252 | } 1253 | } 1254 | } 1255 | }, 1256 | "NewUsersPermissionsUser": { 1257 | "required": [ 1258 | "username", 1259 | "email" 1260 | ], 1261 | "properties": { 1262 | "username": { 1263 | "type": "string", 1264 | "minLength": 3 1265 | }, 1266 | "email": { 1267 | "type": "string", 1268 | "minLength": 6 1269 | }, 1270 | "provider": { 1271 | "type": "string" 1272 | }, 1273 | "password": { 1274 | "type": "string", 1275 | "format": "password", 1276 | "minLength": 6 1277 | }, 1278 | "resetPasswordToken": { 1279 | "type": "string" 1280 | }, 1281 | "confirmationToken": { 1282 | "type": "string" 1283 | }, 1284 | "confirmed": { 1285 | "type": "boolean", 1286 | "default": false 1287 | }, 1288 | "blocked": { 1289 | "type": "boolean", 1290 | "default": false 1291 | }, 1292 | "role": { 1293 | "type": "string" 1294 | }, 1295 | "created_by": { 1296 | "type": "string" 1297 | }, 1298 | "updated_by": { 1299 | "type": "string" 1300 | } 1301 | } 1302 | } 1303 | } 1304 | }, 1305 | "tags": [ 1306 | { 1307 | "name": "UsersPermissions - User" 1308 | } 1309 | ] 1310 | } -------------------------------------------------------------------------------- /extensions/users-permissions/models/User.settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "collectionType", 3 | "collectionName": "users-permissions_user", 4 | "info": { 5 | "name": "user", 6 | "description": "" 7 | }, 8 | "options": { 9 | "draftAndPublish": false, 10 | "timestamps": true 11 | }, 12 | "attributes": { 13 | "username": { 14 | "type": "string", 15 | "minLength": 3, 16 | "unique": true, 17 | "configurable": false, 18 | "required": true 19 | }, 20 | "email": { 21 | "type": "email", 22 | "minLength": 6, 23 | "configurable": false, 24 | "required": true 25 | }, 26 | "provider": { 27 | "type": "string", 28 | "configurable": false 29 | }, 30 | "password": { 31 | "type": "password", 32 | "minLength": 6, 33 | "configurable": false, 34 | "private": true 35 | }, 36 | "resetPasswordToken": { 37 | "type": "string", 38 | "configurable": false, 39 | "private": true 40 | }, 41 | "confirmationToken": { 42 | "type": "string", 43 | "configurable": false, 44 | "private": true 45 | }, 46 | "confirmed": { 47 | "type": "boolean", 48 | "default": false, 49 | "configurable": false 50 | }, 51 | "blocked": { 52 | "type": "boolean", 53 | "default": false, 54 | "configurable": false 55 | }, 56 | "role": { 57 | "model": "role", 58 | "via": "users", 59 | "plugin": "users-permissions", 60 | "configurable": false 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velopert/articles-server/62d24dfb7c2242ca1204fa404e2b370332510cbf/favicon.ico -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "articles-server", 3 | "private": true, 4 | "version": "0.1.0", 5 | "description": "A Strapi application", 6 | "scripts": { 7 | "develop": "strapi develop", 8 | "start": "strapi start", 9 | "build": "strapi build", 10 | "strapi": "strapi" 11 | }, 12 | "devDependencies": {}, 13 | "dependencies": { 14 | "knex": "0.21.18", 15 | "sqlite3": "5.0.0", 16 | "strapi": "3.5.3", 17 | "strapi-admin": "3.5.3", 18 | "strapi-connector-bookshelf": "3.5.3", 19 | "strapi-plugin-content-manager": "3.5.3", 20 | "strapi-plugin-content-type-builder": "3.5.3", 21 | "strapi-plugin-email": "3.5.3", 22 | "strapi-plugin-upload": "3.5.3", 23 | "strapi-plugin-users-permissions": "3.5.3", 24 | "strapi-utils": "3.5.3" 25 | }, 26 | "author": { 27 | "name": "A Strapi developer" 28 | }, 29 | "strapi": { 30 | "uuid": "919fd6db-2df4-4d8c-98b8-d72075d42d26" 31 | }, 32 | "engines": { 33 | "node": ">=10.16.0 <=14.x.x", 34 | "npm": "^6.0.0" 35 | }, 36 | "license": "MIT" 37 | } 38 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # To prevent search engines from seeing the site altogether, uncomment the next two lines: 2 | # User-Agent: * 3 | # Disallow: / 4 | -------------------------------------------------------------------------------- /public/uploads/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velopert/articles-server/62d24dfb7c2242ca1204fa404e2b370332510cbf/public/uploads/.gitkeep --------------------------------------------------------------------------------