Revize 162db5f6
Přidáno uživatelem Vojtěch Bartička před asi 2 roky(ů)
Backend/Backend/Controllers/TagController.cs | ||
---|---|---|
94 | 94 |
|
95 | 95 |
return Ok(); |
96 | 96 |
} |
97 |
|
|
98 |
[HttpPost("/tags")] |
|
99 |
[Authorize(Models.Enums.ERole.ADMINISTRATOR)] |
|
100 |
[ProducesResponseType((int)HttpStatusCode.OK)] |
|
101 |
[ProducesResponseType((int)HttpStatusCode.Forbidden)] |
|
102 |
public ActionResult CreateTag([FromBody] CreateTagRequest request) |
|
103 |
{ |
|
104 |
try |
|
105 |
{ |
|
106 |
tagService.CreateTag(request); |
|
107 |
} |
|
108 |
catch (InvalidOperationException e) |
|
109 |
{ |
|
110 |
throw new BadRequestException(e.Message); |
|
111 |
} |
|
112 |
|
|
113 |
return Ok(); |
|
114 |
} |
|
115 |
|
|
116 |
[HttpDelete("/tag/{tagId}")] |
|
117 |
[Authorize(Models.Enums.ERole.ADMINISTRATOR)] |
|
118 |
[ProducesResponseType((int)HttpStatusCode.OK)] |
|
119 |
[ProducesResponseType((int)HttpStatusCode.Forbidden)] |
|
120 |
public ActionResult DeleteTag(Guid tagId) |
|
121 |
{ |
|
122 |
try |
|
123 |
{ |
|
124 |
tagService.DeleteTag(tagId); |
|
125 |
} |
|
126 |
catch (InvalidOperationException e) |
|
127 |
{ |
|
128 |
throw new BadRequestException(e.Message); |
|
129 |
} |
|
130 |
|
|
131 |
return Ok(); |
|
132 |
} |
|
133 |
|
|
134 |
[HttpPut("/tag/{tagId}")] |
|
135 |
[Authorize(Models.Enums.ERole.ADMINISTRATOR)] |
|
136 |
[ProducesResponseType((int)HttpStatusCode.OK)] |
|
137 |
[ProducesResponseType((int)HttpStatusCode.Forbidden)] |
|
138 |
public ActionResult UpdateTag([FromBody] ModifyTagRequest request, Guid tagId) |
|
139 |
{ |
|
140 |
try |
|
141 |
{ |
|
142 |
tagService.UpdateTag(request, tagId); |
|
143 |
} |
|
144 |
catch (InvalidOperationException e) |
|
145 |
{ |
|
146 |
throw new BadRequestException(e.Message); |
|
147 |
} |
|
148 |
|
|
149 |
return Ok(); |
|
150 |
} |
|
97 | 151 |
} |
98 | 152 |
|
Také k dispozici: Unified diff
Added endpoints for Tag CRUD