Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1405470c
Commit
1405470c
authored
Nov 11, 2020
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create IncidentManagement::OncallSchedule model
The storage for Incident Management on-call schedules
parent
0316d92f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
1 deletion
+57
-1
app/models/concerns/enums/internal_id.rb
app/models/concerns/enums/internal_id.rb
+2
-1
app/models/incident_management/oncall_schedule.rb
app/models/incident_management/oncall_schedule.rb
+22
-0
app/models/project.rb
app/models/project.rb
+1
-0
spec/factories/incident_management/oncall_schedules.rb
spec/factories/incident_management/oncall_schedules.rb
+10
-0
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+1
-0
spec/models/incident_management/oncall_schedule_spec.rb
spec/models/incident_management/oncall_schedule_spec.rb
+21
-0
No files found.
app/models/concerns/enums/internal_id.rb
View file @
1405470c
...
...
@@ -15,7 +15,8 @@ module Enums
operations_user_lists:
7
,
alert_management_alerts:
8
,
sprints:
9
,
# iterations
design_management_designs:
10
design_management_designs:
10
,
incident_management_oncall_schedules:
11
}
end
end
...
...
app/models/incident_management/oncall_schedule.rb
0 → 100644
View file @
1405470c
# frozen_string_literal: true
module
IncidentManagement
class
OncallSchedule
<
ApplicationRecord
self
.
table_name
=
'incident_management_oncall_schedules'
include
IidRoutes
include
AtomicInternalId
NAME_LENGTH
=
200
DESCRIPTION_LENGTH
=
1000
TIMEZONE_LENGTH
=
100
belongs_to
:project
,
inverse_of: :incident_management_oncall_schedules
has_internal_id
:iid
,
scope: :project
validates
:name
,
presence:
true
,
length:
{
maximum:
NAME_LENGTH
}
validates
:description
,
length:
{
maximum:
DESCRIPTION_LENGTH
}
validates
:timezone
,
presence:
true
,
length:
{
maximum:
TIMEZONE_LENGTH
}
end
end
app/models/project.rb
View file @
1405470c
...
...
@@ -273,6 +273,7 @@ class Project < ApplicationRecord
has_many
:alert_management_alerts
,
class_name:
'AlertManagement::Alert'
,
inverse_of: :project
has_many
:alert_management_http_integrations
,
class_name:
'AlertManagement::HttpIntegration'
,
inverse_of: :project
has_many
:incident_management_oncall_schedules
,
class_name:
'IncidentManagement::OncallSchedule'
,
inverse_of: :project
# Container repositories need to remove data from the container registry,
# which is not managed by the DB. Hence we're still using dependent: :destroy
...
...
spec/factories/incident_management/oncall_schedules.rb
0 → 100644
View file @
1405470c
# frozen_string_literal: true
FactoryBot
.
define
do
factory
:incident_management_oncall_schedule
,
class:
'IncidentManagement::OncallSchedule'
do
project
name
{
'Default On-call Schedule'
}
description
{
'On-call description'
}
timezone
{
'Europe/Berlin'
}
end
end
spec/lib/gitlab/import_export/all_models.yml
View file @
1405470c
...
...
@@ -554,6 +554,7 @@ project:
-
terraform_states
-
alert_management_http_integrations
-
exported_protected_branches
-
incident_management_oncall_schedules
award_emoji
:
-
awardable
-
user
...
...
spec/models/incident_management/oncall_schedule_spec.rb
0 → 100644
View file @
1405470c
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
IncidentManagement
::
OncallSchedule
do
let_it_be
(
:project
)
{
create
(
:project
)
}
describe
'.associations'
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
end
describe
'.validations'
do
subject
{
build
(
:incident_management_oncall_schedule
,
project:
project
)
}
it
{
is_expected
.
to
validate_presence_of
(
:name
)
}
it
{
is_expected
.
to
validate_length_of
(
:name
).
is_at_most
(
200
)
}
it
{
is_expected
.
to
validate_length_of
(
:description
).
is_at_most
(
1000
)
}
it
{
is_expected
.
to
validate_presence_of
(
:timezone
)
}
it
{
is_expected
.
to
validate_length_of
(
:timezone
).
is_at_most
(
100
)
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment