@@ -11,19 +11,83 @@ class RevisionsController < ApplicationController
11
11
validate_sprint_dependencies ( :id , "revision" )
12
12
end
13
13
14
+ def_param_group :revision do
15
+ param :done_report , Array , of : String , :desc => "Sprint revision's done report"
16
+ param :undone_report , Array , of : String , :desc => "Sprint revision's undone report"
17
+ param :created_at , Date , "Revision's time of creation" , :allow_nil => false
18
+ param :updated_at , Date , "Revision's time of edition" , :allow_nil => false
19
+ param :sprint_id , :number , "Id of sprint revised"
20
+ end
21
+
22
+ api :GET , "/sprints/:sprint_id/revisions" , "Show revisions for a sprint"
23
+ error :code => 401 , :desc => "Unauthorized"
24
+ error :code => 404 , :desc => "Not Found"
25
+ error :code => 500 , :desc => "Internal Server Error"
26
+ description "Show all revisions of a specific sprint"
27
+ returns :code => 200 , :desc => "Ok" do
28
+ param_group :revision
29
+ end
30
+ example <<-EOS
31
+ {
32
+ "id": 1,
33
+ "done_report": [
34
+ "Story US11 was done."
35
+ ],
36
+ "undone_report": [
37
+ "Story US21 was not done."
38
+ ],
39
+ "created_at": "2019-04-11T15:42:35.826Z",
40
+ "updated_at": "2019-04-11T15:42:35.826Z",
41
+ "sprint_id": 1
42
+ }
43
+ EOS
14
44
def index
15
45
@revision = @sprint . revision
16
46
render json : @revision
17
47
end
18
48
49
+ api :POST , "/sprints/:sprint_id/revisions" , "Create a revision"
50
+ error :code => 401 , :desc => "Unauthorized"
51
+ error :code => 404 , :desc => "Not Found"
52
+ error :code => 500 , :desc => "Internal Server Error"
53
+ description 'Create revision for a specific sprint'
54
+ param_group :revision
19
55
def create
20
56
create_sprint_dependencies ( "revision" , revision_params )
21
57
end
22
58
59
+ api :GET , "/revisions/:id" , "Show a revision"
60
+ error :code => 401 , :desc => "Unauthorized"
61
+ error :code => 404 , :desc => "Not Found"
62
+ error :code => 500 , :desc => "Internal Server Error"
63
+ description "Show a revision of a specific sprint"
64
+ returns :code => 200 , :desc => "Ok" do
65
+ param_group :revision
66
+ end
67
+ example <<-EOS
68
+ {
69
+ "id": 2,
70
+ "done_report": [
71
+ "Story US12 was done."
72
+ ],
73
+ "undone_report": [
74
+ "Story US22 was not done."
75
+ ],
76
+ "created_at": "2019-04-11T15:42:35.851Z",
77
+ "updated_at": "2019-04-11T15:42:35.851Z",
78
+ "sprint_id": 2
79
+ }
80
+ EOS
23
81
def show
24
82
render json : @revision
25
83
end
26
84
85
+ api :PATCH , "/revisions/:id" , "Update a revision"
86
+ error :code => 401 , :desc => "Unauthorized"
87
+ error :code => 404 , :desc => "Not Found"
88
+ error :code => 500 , :desc => "Internal Server Error"
89
+ description 'Update revision for a specific sprint'
90
+ param_group :revision
27
91
def update
28
92
if @revision . update ( revision_params )
29
93
render json : @revision
@@ -32,6 +96,12 @@ def update
32
96
end
33
97
end
34
98
99
+ api :DELETE , "/revisions/:id" , "Delete a revision"
100
+ error :code => 401 , :desc => "Unauthorized"
101
+ error :code => 404 , :desc => "Not Found"
102
+ error :code => 500 , :desc => "Internal Server Error"
103
+ description 'Delete revision for a specific sprint'
104
+ param_group :revision
35
105
def destroy
36
106
@revision . destroy
37
107
end
0 commit comments