Commit ee8526d1 authored by Thong Kuah's avatar Thong Kuah

Not everything is a service object

Clarify what is a service object, and alternatives if the object
is not a service object
parent dfa79015
......@@ -6,13 +6,7 @@
# and existing service will use these one by one.
# After all are migrated, we can remove this class.
#
# New services should consider inheriting from:
#
# - BaseContainerService for services scoped by container (project or group)
# - BaseProjectService for services scoped to projects
# - BaseGroupService for services scoped to groups
#
# or, create a new base class and update this comment.
# For new services, please see https://docs.gitlab.com/ee/development/reusing_abstractions.html#service-classes
class BaseService
include BaseServiceUtility
include Gitlab::Experiment::Dsl
......
......@@ -133,8 +133,20 @@ Everything in `lib/api`.
Everything that resides in `app/services`.
Services should consider inheriting from:
- `BaseContainerService` for services scoped by container (project or group)
- `BaseProjectService` for services scoped to projects
- `BaseGroupService` for services scoped to groups
or, create a new base class and update the list above.
Legacy classes inherited from `BaseService` for historical reasons.
In Service classes the use of `execute` and `#execute` is preferred over `call` and `#call`.
Classes that are not service objects should be [created elsewhere](directory_structure.md#use-namespaces-to-define-bounded-contexts, such as in `lib`.
#### ServiceResponse
Service classes usually have an `execute` method, which can return a
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment