Skip to content

Commit 0fd0599

Browse files
author
vikasrohit
authored
Merge pull request #519 from topcoder-platform/feature/link-attachments
Links as Attachments + Tags
2 parents d84172e + d2f7b71 commit 0fd0599

38 files changed

+5712
-2388
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,5 @@ docker exec -it tc-projects-kafka /opt/kafka/bin/kafka-console-producer.sh --bro
275275

276276
## References
277277

278-
- [Projects Service Architecture](./docs/guides/architercture/architecture.md)
278+
- [Projects Service Architecture](./docs/guides/architercture/architecture.md)
279+
- [Projects Service Architecture](./docs/guides/architercture/architecture.md)

config/test.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"logLevel": "debug",
55
"captureLogs": "false",
66
"logentriesToken": "",
7+
"enableFileUpload": "false",
78
"elasticsearchConfig": {
89
"host": "http://localhost:9200",
910
"apiVersion": "6.8",

docs/Project API.postman_collection.json

Lines changed: 168 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"info": {
3-
"_postman_id": "a0a9f1a7-84b1-45ad-a4c0-baa3552118cb",
3+
"_postman_id": "c69ab4dd-8c6a-48c9-ba48-c6663b1a0c81",
44
"name": "Project API",
55
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
66
},
@@ -248,7 +248,7 @@
248248
"_postman_isSubFolder": true
249249
},
250250
{
251-
"name": "Upload attachment",
251+
"name": "Upload file attachment",
252252
"event": [
253253
{
254254
"listen": "test",
@@ -257,7 +257,7 @@
257257
"exec": [
258258
"pm.test(\"Status code is 201\", function () {",
259259
" pm.response.to.have.status(201);",
260-
" pm.environment.set(\"attachmentId\", pm.response.json().id);",
260+
" pm.environment.set(\"fileAttachmentId\", pm.response.json().id);",
261261
"});"
262262
],
263263
"type": "text/javascript"
@@ -278,7 +278,7 @@
278278
],
279279
"body": {
280280
"mode": "raw",
281-
"raw": "{\n\t\t\"title\": \"first attachment submission\",\n\t\t\"filePath\": \"/home/phoenix/a.png\",\n\t\t\"s3Bucket\": \"topcoder-project-service\",\n\t\t\"contentType\": \"application/png\"\n\t}"
281+
"raw": "{\n\t\"title\": \"first file attachment\",\n\t\"path\": \"/home/files/phoenix/a.png\",\n\t\"type\": \"file\",\n\t\"s3Bucket\": \"topcoder-project-service\",\n\t\"contentType\": \"application/png\",\n\t\"tags\": [\"design preview\"]\n}"
282282
},
283283
"url": {
284284
"raw": "{{api-url}}/projects/{{projectId}}/attachments",
@@ -296,7 +296,55 @@
296296
"response": []
297297
},
298298
{
299-
"name": "Update attachment",
299+
"name": "Create link as attachment",
300+
"event": [
301+
{
302+
"listen": "test",
303+
"script": {
304+
"id": "6547ada6-53f5-4e2d-bda0-f0ec5bfbe38f",
305+
"exec": [
306+
"pm.test(\"Status code is 201\", function () {",
307+
" pm.response.to.have.status(201);",
308+
" pm.environment.set(\"linkAttachmentId\", pm.response.json().id);",
309+
"});"
310+
],
311+
"type": "text/javascript"
312+
}
313+
}
314+
],
315+
"request": {
316+
"method": "POST",
317+
"header": [
318+
{
319+
"key": "Authorization",
320+
"value": "Bearer {{jwt-token}}"
321+
},
322+
{
323+
"key": "Content-Type",
324+
"value": "application/json"
325+
}
326+
],
327+
"body": {
328+
"mode": "raw",
329+
"raw": "{\n\t\"title\": \"link attachment\",\n\t\"path\": \"https://connect.topcoder-dev.com/projects/8600/assets.zip\",\n\t\"type\": \"link\",\n\t\"tags\": [\"specification\", \"design preview\", \"billing information\"]\n}"
330+
},
331+
"url": {
332+
"raw": "{{api-url}}/projects/{{projectId}}/attachments",
333+
"host": [
334+
"{{api-url}}"
335+
],
336+
"path": [
337+
"projects",
338+
"{{projectId}}",
339+
"attachments"
340+
]
341+
},
342+
"description": "Create an project attachment"
343+
},
344+
"response": []
345+
},
346+
{
347+
"name": "Update file attachment",
300348
"request": {
301349
"method": "PATCH",
302350
"header": [
@@ -311,28 +359,65 @@
311359
],
312360
"body": {
313361
"mode": "raw",
314-
"raw": "{\n\t\t\"title\": \"first attachment submission updated\",\n\t\t\"description\": \"updated project attachment\"\n\t}"
362+
"raw": "{\n\t\t\"title\": \"first attachment submission updated\",\n\t\t\"description\": \"updated project attachment\",\n\t\t\"tags\": [\"anotherTag\"]\n\t}"
315363
},
316364
"url": {
317-
"raw": "{{api-url}}/projects/{{projectId}}/attachments/{{attachmentId}}",
365+
"raw": "{{api-url}}/projects/{{projectId}}/attachments/{{fileAttachmentId}}",
318366
"host": [
319367
"{{api-url}}"
320368
],
321369
"path": [
322370
"projects",
323371
"{{projectId}}",
324372
"attachments",
325-
"{{attachmentId}}"
373+
"{{fileAttachmentId}}"
326374
]
327375
},
328376
"description": "Update project attachment"
329377
},
330378
"response": []
331379
},
332380
{
333-
"name": "Delete attachment",
381+
"name": "Update link attachment",
334382
"request": {
335-
"method": "DELETE",
383+
"method": "PATCH",
384+
"header": [
385+
{
386+
"key": "Authorization",
387+
"value": "Bearer {{jwt-token}}"
388+
},
389+
{
390+
"key": "Content-Type",
391+
"value": "application/json"
392+
}
393+
],
394+
"body": {
395+
"mode": "raw",
396+
"raw": "{\n\t\t\"title\": \"updated link title\",\n\t\t\"description\": \"updated link description\",\n\t\t\"tags\": [\"linkTag1\"]\n\t}"
397+
},
398+
"url": {
399+
"raw": "{{api-url}}/projects/{{projectId}}/attachments/{{linkAttachmentId}}",
400+
"host": [
401+
"{{api-url}}"
402+
],
403+
"path": [
404+
"projects",
405+
"{{projectId}}",
406+
"attachments",
407+
"{{linkAttachmentId}}"
408+
]
409+
},
410+
"description": "Update project attachment"
411+
},
412+
"response": []
413+
},
414+
{
415+
"name": "Get file attachment",
416+
"protocolProfileBehavior": {
417+
"disableBodyPruning": true
418+
},
419+
"request": {
420+
"method": "GET",
336421
"header": [
337422
{
338423
"key": "Authorization",
@@ -348,23 +433,23 @@
348433
"raw": ""
349434
},
350435
"url": {
351-
"raw": "{{api-url}}/projects/{{projectId}}/attachments/{{attachmentId}}",
436+
"raw": "{{api-url}}/projects/{{projectId}}/attachments/{{fileAttachmentId}}",
352437
"host": [
353438
"{{api-url}}"
354439
],
355440
"path": [
356441
"projects",
357442
"{{projectId}}",
358443
"attachments",
359-
"{{attachmentId}}"
444+
"{{fileAttachmentId}}"
360445
]
361446
},
362447
"description": "Delete a project attachment"
363448
},
364449
"response": []
365450
},
366451
{
367-
"name": "Download attachment",
452+
"name": "Get link attachment",
368453
"protocolProfileBehavior": {
369454
"disableBodyPruning": true
370455
},
@@ -385,15 +470,15 @@
385470
"raw": ""
386471
},
387472
"url": {
388-
"raw": "{{api-url}}/projects/{{projectId}}/attachments/{{attachmentId}}",
473+
"raw": "{{api-url}}/projects/{{projectId}}/attachments/{{linkAttachmentId}}",
389474
"host": [
390475
"{{api-url}}"
391476
],
392477
"path": [
393478
"projects",
394479
"{{projectId}}",
395480
"attachments",
396-
"{{attachmentId}}"
481+
"{{linkAttachmentId}}"
397482
]
398483
},
399484
"description": "Delete a project attachment"
@@ -435,6 +520,74 @@
435520
"description": "Delete a project attachment"
436521
},
437522
"response": []
523+
},
524+
{
525+
"name": "Delete link attachment",
526+
"request": {
527+
"method": "DELETE",
528+
"header": [
529+
{
530+
"key": "Authorization",
531+
"value": "Bearer {{jwt-token}}"
532+
},
533+
{
534+
"key": "Content-Type",
535+
"value": "application/json"
536+
}
537+
],
538+
"body": {
539+
"mode": "raw",
540+
"raw": ""
541+
},
542+
"url": {
543+
"raw": "{{api-url}}/projects/{{projectId}}/attachments/{{linkAttachmentId}}",
544+
"host": [
545+
"{{api-url}}"
546+
],
547+
"path": [
548+
"projects",
549+
"{{projectId}}",
550+
"attachments",
551+
"{{linkAttachmentId}}"
552+
]
553+
},
554+
"description": "Delete a project attachment"
555+
},
556+
"response": []
557+
},
558+
{
559+
"name": "Delete file attachment",
560+
"request": {
561+
"method": "DELETE",
562+
"header": [
563+
{
564+
"key": "Authorization",
565+
"value": "Bearer {{jwt-token}}"
566+
},
567+
{
568+
"key": "Content-Type",
569+
"value": "application/json"
570+
}
571+
],
572+
"body": {
573+
"mode": "raw",
574+
"raw": ""
575+
},
576+
"url": {
577+
"raw": "{{api-url}}/projects/{{projectId}}/attachments/{{fileAttachmentId}}",
578+
"host": [
579+
"{{api-url}}"
580+
],
581+
"path": [
582+
"projects",
583+
"{{projectId}}",
584+
"attachments",
585+
"{{fileAttachmentId}}"
586+
]
587+
},
588+
"description": "Delete a project attachment"
589+
},
590+
"response": []
438591
}
439592
],
440593
"protocolProfileBehavior": {}

0 commit comments

Comments
 (0)