Documentation
¶
Index ¶
- Constants
- func CreateRepos() *repos.Repos
- func CreateTestRepos(t *testing.T) *repos.Repos
- func NewMovie(d models.DBTX, logger *zap.SugaredLogger, moviec tfidf.MovieGenreClient) *movie
- type Activity
- func (a *Activity) ByID(ctx context.Context, d models.DBTX, id models.ActivityID) (*models.Activity, error)
- func (a *Activity) ByName(ctx context.Context, d models.DBTX, name string, projectID models.ProjectID) (*models.Activity, error)
- func (a *Activity) ByProjectID(ctx context.Context, d models.DBTX, projectID models.ProjectID) ([]models.Activity, error)
- func (a *Activity) Create(ctx context.Context, d models.DBTX, projectName models.ProjectName, ...) (*models.Activity, error)
- func (a *Activity) Delete(ctx context.Context, d models.DBTX, id models.ActivityID) (*models.Activity, error)
- func (a *Activity) Restore(ctx context.Context, d models.DBTX, id models.ActivityID) error
- func (a *Activity) Update(ctx context.Context, d models.DBTX, id models.ActivityID, ...) (*models.Activity, error)
- type Admin
- type AppClaims
- type Authentication
- func (a *Authentication) CreateAPIKeyForUser(ctx context.Context, user *models.User) (*models.UserAPIKey, error)
- func (a *Authentication) CreateAccessTokenForUser(ctx context.Context, user *models.User) (string, error)
- func (a *Authentication) GetOrRegisterUserFromUserInfo(ctx context.Context, userinfo oidc.UserInfo) (*models.User, error)
- func (a *Authentication) GetUserFromAPIKey(ctx context.Context, apiKey string) (*models.User, error)
- func (a *Authentication) GetUserFromAccessToken(ctx context.Context, token string) (*models.User, error)
- func (a *Authentication) ParseToken(ctx context.Context, token string) (*AppClaims, error)
- type Authorization
- func (a *Authorization) DefaultScopes(role models.Role) models.Scopes
- func (a *Authorization) HasRequiredRole(role Role, requiredRole models.Role) error
- func (a *Authorization) HasRequiredScopes(scopes models.Scopes, requiredScopes models.Scopes) error
- func (a *Authorization) RoleByName(role models.Role) Role
- func (a *Authorization) RoleByRank(rank int) (Role, bool)
- func (a *Authorization) ScopeByName(scope string) (Scope, error)
- type Board
- type CtxUser
- type DemoTwoWorkItem
- func (w *DemoTwoWorkItem) ByID(ctx context.Context, d models.DBTX, id models.WorkItemID) (*models.WorkItem, error)
- func (w *DemoTwoWorkItem) Create(ctx context.Context, d models.DBTX, caller CtxUser, ...) (*models.WorkItem, error)
- func (w *DemoTwoWorkItem) List(ctx context.Context, d models.DBTX, teamID models.TeamID) ([]models.WorkItem, error)
- func (w *DemoTwoWorkItem) ListDeleted(ctx context.Context, d models.DBTX, teamID models.TeamID) ([]models.WorkItem, error)
- func (w *DemoTwoWorkItem) Update(ctx context.Context, d models.DBTX, caller CtxUser, id models.WorkItemID, ...) (*models.WorkItem, error)
- type DemoTwoWorkItemCreateParams
- type DemoWorkItem
- func (w *DemoWorkItem) ByID(ctx context.Context, d models.DBTX, id models.WorkItemID) (*models.WorkItem, error)
- func (w *DemoWorkItem) Create(ctx context.Context, d models.DBTX, caller CtxUser, ...) (*models.WorkItem, error)
- func (w *DemoWorkItem) List(ctx context.Context, d models.DBTX, teamID int) ([]models.WorkItem, error)
- func (w *DemoWorkItem) ListDeleted(ctx context.Context, d models.DBTX, teamID models.TeamID) ([]models.WorkItem, error)
- func (w *DemoWorkItem) Update(ctx context.Context, d models.DBTX, caller CtxUser, id models.WorkItemID, ...) (*models.WorkItem, error)
- type DemoWorkItemCreateParams
- type KanbanStep
- type Member
- type Notification
- func (n *Notification) CreateNotification(ctx context.Context, d models.DBTX, params *NotificationCreateParams) (*models.UserNotification, error)
- func (n *Notification) LatestNotifications(ctx context.Context, d models.DBTX, params *models.GetUserNotificationsParams) ([]models.GetUserNotificationsRow, error)
- func (n *Notification) PaginatedUserNotifications(ctx context.Context, d models.DBTX, userID models.UserID, ...) ([]models.UserNotification, error)
- type NotificationCreateParams
- type PaginationParams
- type PaginationParamsDirection
- type Project
- type Role
- type Scope
- type Services
- type Team
- func (t *Team) ByID(ctx context.Context, d models.DBTX, id models.TeamID) (*models.Team, error)
- func (t *Team) ByName(ctx context.Context, d models.DBTX, name string, projectID models.ProjectID) (*models.Team, error)
- func (t *Team) Create(ctx context.Context, d models.DBTX, params *models.TeamCreateParams) (*models.Team, error)
- func (t *Team) Delete(ctx context.Context, d models.DBTX, id models.TeamID) (*models.Team, error)
- func (t *Team) Update(ctx context.Context, d models.DBTX, id models.TeamID, ...) (*models.Team, error)
- type TimeEntry
- func (te *TimeEntry) ByID(ctx context.Context, d models.DBTX, id models.TimeEntryID) (*models.TimeEntry, error)
- func (te *TimeEntry) Create(ctx context.Context, d models.DBTX, caller CtxUser, ...) (*models.TimeEntry, error)
- func (te *TimeEntry) Delete(ctx context.Context, d models.DBTX, id models.TimeEntryID) (*models.TimeEntry, error)
- func (te *TimeEntry) Update(ctx context.Context, d models.DBTX, caller CtxUser, id models.TimeEntryID, ...) (*models.TimeEntry, error)
- type TimeEntryUpdateParams
- type User
- func (u *User) AssignTeam(ctx context.Context, d models.DBTX, userID models.UserID, teamID models.TeamID) (*models.User, error)
- func (u *User) ByAPIKey(ctx context.Context, d models.DBTX, apiKey string) (*models.User, error)
- func (u *User) ByEmail(ctx context.Context, d models.DBTX, email string, ...) (*models.User, error)
- func (u *User) ByExternalID(ctx context.Context, d models.DBTX, id string, ...) (*models.User, error)
- func (u *User) ByID(ctx context.Context, d models.DBTX, id models.UserID, ...) (*models.User, error)
- func (u *User) ByUsername(ctx context.Context, d models.DBTX, username string, ...) (*models.User, error)
- func (u *User) CreateAPIKey(ctx context.Context, d models.DBTX, user *models.User) (*models.UserAPIKey, error)
- func (u *User) Delete(ctx context.Context, d models.DBTX, id models.UserID) (*models.User, error)
- func (u *User) LatestGlobalNotifications(ctx context.Context, d models.DBTX, userID models.UserID) ([]models.GetUserNotificationsRow, error)
- func (u *User) LatestPersonalNotifications(ctx context.Context, d models.DBTX, userID models.UserID) ([]models.UserNotification, error)
- func (u *User) Paginated(ctx context.Context, d models.DBTX, params models.GetPaginatedUsersParams) ([]models.User, error)
- func (u *User) Register(ctx context.Context, d models.DBTX, params UserRegisterParams) (*models.User, error)
- func (u *User) Update(ctx context.Context, d models.DBTX, id models.UserID, caller CtxUser, ...) (*models.User, error)
- func (u *User) UpdateUserAuthorization(ctx context.Context, d models.DBTX, id models.UserID, caller CtxUser, ...) (*models.User, error)
- type UserRegisterParams
- type WorkItem
- func (w *WorkItem) AssignTags(ctx context.Context, d models.DBTX, workItemID models.WorkItemID, ...) error
- func (w *WorkItem) AssignUsers(ctx context.Context, d models.DBTX, workItemID models.WorkItemID, ...) error
- func (w *WorkItem) Delete(ctx context.Context, d models.DBTX, id models.WorkItemID) (*models.WorkItem, error)
- func (w *WorkItem) RemoveAssignedUsers(ctx context.Context, d models.DBTX, workItemID models.WorkItemID, ...) error
- func (w *WorkItem) RemoveTags(ctx context.Context, d models.DBTX, workItemID models.WorkItemID, ...) error
- func (w *WorkItem) Restore(ctx context.Context, d models.DBTX, id models.WorkItemID) (*models.WorkItem, error)
- type WorkItemComment
- func (t *WorkItemComment) ByID(ctx context.Context, d models.DBTX, id models.WorkItemCommentID) (*models.WorkItemComment, error)
- func (t *WorkItemComment) Create(ctx context.Context, d models.DBTX, params *models.WorkItemCommentCreateParams) (*models.WorkItemComment, error)
- func (t *WorkItemComment) Delete(ctx context.Context, d models.DBTX, caller CtxUser, ...) (*models.WorkItemComment, error)
- func (t *WorkItemComment) Update(ctx context.Context, d models.DBTX, caller CtxUser, ...) (*models.WorkItemComment, error)
- type WorkItemCreateParams
- type WorkItemTag
- func (wit *WorkItemTag) ByID(ctx context.Context, d models.DBTX, id models.WorkItemTagID) (*models.WorkItemTag, error)
- func (wit *WorkItemTag) ByName(ctx context.Context, d models.DBTX, name string, projectID models.ProjectID) (*models.WorkItemTag, error)
- func (wit *WorkItemTag) Create(ctx context.Context, d models.DBTX, caller CtxUser, ...) (*models.WorkItemTag, error)
- func (wit *WorkItemTag) Delete(ctx context.Context, d models.DBTX, caller CtxUser, id models.WorkItemTagID) (*models.WorkItemTag, error)
- func (wit *WorkItemTag) Update(ctx context.Context, d models.DBTX, caller CtxUser, id models.WorkItemTagID, ...) (*models.WorkItemTag, error)
- type WorkItemType
Constants ¶
const ( PaginationParamsDirectionAsc = "asc" PaginationParamsDirectionDesc = "desc" )
const OtelName = "github.com/danicc097/openapi-go-gin-postgres-sqlc/internal/services"
Variables ¶
This section is empty.
Functions ¶
func CreateRepos ¶
CreateRepos creates repositories for service usage.
func CreateTestRepos ¶
CreateTestRepos creates repositories with convenient wrappers for testing.
func NewMovie ¶
func NewMovie(d models.DBTX, logger *zap.SugaredLogger, moviec tfidf.MovieGenreClient) *movie
NewMovie returns a new movie service. This is a sample service to showcase grpc + opentelemetry.
Types ¶
type Activity ¶
type Activity struct {
// contains filtered or unexported fields
}
func NewActivity ¶
func NewActivity(logger *zap.SugaredLogger, repos *repos.Repos) *Activity
NewActivity returns a new Activity service.
func (*Activity) ByID ¶
func (a *Activity) ByID(ctx context.Context, d models.DBTX, id models.ActivityID) (*models.Activity, error)
ByID gets an activity by ID.
func (*Activity) ByName ¶
func (a *Activity) ByName(ctx context.Context, d models.DBTX, name string, projectID models.ProjectID) (*models.Activity, error)
ByName gets an activity by name.
func (*Activity) ByProjectID ¶
func (a *Activity) ByProjectID(ctx context.Context, d models.DBTX, projectID models.ProjectID) ([]models.Activity, error)
ByProjectID gets activities by project ID.
func (*Activity) Create ¶
func (a *Activity) Create(ctx context.Context, d models.DBTX, projectName models.ProjectName, params *models.ActivityCreateParams) (*models.Activity, error)
Create creates a new activity.
func (*Activity) Delete ¶
func (a *Activity) Delete(ctx context.Context, d models.DBTX, id models.ActivityID) (*models.Activity, error)
Delete deletes an activity by ID.
type Authentication ¶
type Authentication struct {
// contains filtered or unexported fields
}
func NewAuthentication ¶
func NewAuthentication(logger *zap.SugaredLogger, repos *repos.Repos, pool *pgxpool.Pool) *Authentication
NewAuthentication returns a new authentication service. TODO should we use tx instead of providing pool only.
func (*Authentication) CreateAPIKeyForUser ¶
func (a *Authentication) CreateAPIKeyForUser(ctx context.Context, user *models.User) (*models.UserAPIKey, error)
CreateAPIKeyForUser creates a new API key for a user.
func (*Authentication) CreateAccessTokenForUser ¶
func (a *Authentication) CreateAccessTokenForUser(ctx context.Context, user *models.User) (string, error)
CreateAccessTokenForUser creates a new token for a user.
func (*Authentication) GetOrRegisterUserFromUserInfo ¶
func (a *Authentication) GetOrRegisterUserFromUserInfo(ctx context.Context, userinfo oidc.UserInfo) (*models.User, error)
GetOrRegisterUserFromUserInfo returns a user from user info.
func (*Authentication) GetUserFromAPIKey ¶
func (a *Authentication) GetUserFromAPIKey(ctx context.Context, apiKey string) (*models.User, error)
GetUserFromAPIKey returns a user from an api key.
func (*Authentication) GetUserFromAccessToken ¶
func (a *Authentication) GetUserFromAccessToken(ctx context.Context, token string) (*models.User, error)
GetUserFromAccessToken returns a user from a token.
func (*Authentication) ParseToken ¶
ParseToken returns a token string claims.
type Authorization ¶
type Authorization struct {
// contains filtered or unexported fields
}
Authorization represents a service for authorization.
func NewAuthorization ¶
func NewAuthorization(logger *zap.SugaredLogger) *Authorization
NewAuthorization returns a new Authorization service. Existing roles and scopes will be loaded from the given policy JSON file paths.
func (*Authorization) DefaultScopes ¶
func (a *Authorization) DefaultScopes(role models.Role) models.Scopes
DefaultScopes returns the default scopes for a role. Scopes are assigned/revoked upon role change (reset completely).
func (*Authorization) HasRequiredRole ¶
func (a *Authorization) HasRequiredRole(role Role, requiredRole models.Role) error
func (*Authorization) HasRequiredScopes ¶
func (*Authorization) RoleByName ¶
func (a *Authorization) RoleByName(role models.Role) Role
func (*Authorization) RoleByRank ¶
func (a *Authorization) RoleByRank(rank int) (Role, bool)
func (*Authorization) ScopeByName ¶
func (a *Authorization) ScopeByName(scope string) (Scope, error)
type Board ¶
type Board struct {
// contains filtered or unexported fields
}
func NewBoard ¶
func NewBoard(logger *zap.SugaredLogger, projectRepo repos.Project, teamRepo repos.Team, workItemTagRepo repos.WorkItemTag, workItemTypeRepo repos.WorkItemType, authzsvc *Authorization, ) *Board
NewBoard returns a new Board service.
type CtxUser ¶
type CtxUser struct { // db user object with no joins *models.User Role Role Teams []models.Team Projects []models.Project APIKey *models.UserAPIKey }
func NewCtxUser ¶
NewCtxUser returns a new CtxUser. Required joins: Teams, Projects.
type DemoTwoWorkItem ¶
type DemoTwoWorkItem struct {
// contains filtered or unexported fields
}
func NewDemoTwoWorkItem ¶
func NewDemoTwoWorkItem(logger *zap.SugaredLogger, repos *repos.Repos) *DemoTwoWorkItem
NewDemoTwoWorkItem returns a new DemoTwoWorkItem service.
func (*DemoTwoWorkItem) ByID ¶
func (w *DemoTwoWorkItem) ByID(ctx context.Context, d models.DBTX, id models.WorkItemID) (*models.WorkItem, error)
ByID gets a work item by ID.
func (*DemoTwoWorkItem) Create ¶
func (w *DemoTwoWorkItem) Create(ctx context.Context, d models.DBTX, caller CtxUser, params DemoTwoWorkItemCreateParams) (*models.WorkItem, error)
Create creates a new work item.
func (*DemoTwoWorkItem) ListDeleted ¶
func (*DemoTwoWorkItem) Update ¶
func (w *DemoTwoWorkItem) Update(ctx context.Context, d models.DBTX, caller CtxUser, id models.WorkItemID, params repos.DemoTwoWorkItemUpdateParams) (*models.WorkItem, error)
Update updates an existing work item.
type DemoTwoWorkItemCreateParams ¶
type DemoTwoWorkItemCreateParams struct { repos.DemoTwoWorkItemCreateParams WorkItemCreateParams }
type DemoWorkItem ¶
type DemoWorkItem struct {
// contains filtered or unexported fields
}
func NewDemoWorkItem ¶
func NewDemoWorkItem(logger *zap.SugaredLogger, repos *repos.Repos) *DemoWorkItem
NewDemoWorkItem returns a new DemoWorkItem service.
func (*DemoWorkItem) ByID ¶
func (w *DemoWorkItem) ByID(ctx context.Context, d models.DBTX, id models.WorkItemID) (*models.WorkItem, error)
ByID gets a work item by ID.
func (*DemoWorkItem) Create ¶
func (w *DemoWorkItem) Create(ctx context.Context, d models.DBTX, caller CtxUser, params DemoWorkItemCreateParams) (*models.WorkItem, error)
Create creates a new work item.
func (*DemoWorkItem) ListDeleted ¶
func (*DemoWorkItem) Update ¶
func (w *DemoWorkItem) Update(ctx context.Context, d models.DBTX, caller CtxUser, id models.WorkItemID, params repos.DemoWorkItemUpdateParams) (*models.WorkItem, error)
Update updates an existing work item.
type DemoWorkItemCreateParams ¶
type DemoWorkItemCreateParams struct { repos.DemoWorkItemCreateParams WorkItemCreateParams }
type KanbanStep ¶
type KanbanStep struct {
// contains filtered or unexported fields
}
func NewKanbanStep ¶
func NewKanbanStep(logger *zap.SugaredLogger, ksrepo repos.KanbanStep) *KanbanStep
NewKanbanStep returns a new KanbanStep service.
func (*KanbanStep) ByID ¶
func (ks *KanbanStep) ByID(ctx context.Context, d models.DBTX, id models.KanbanStepID) (*models.KanbanStep, error)
ByID gets a KanbanStep by ID.
type Member ¶
type Member struct { Role models.WorkItemRole `json:"role" ref:"#/components/schemas/WorkItemRole" required:"true"` UserID models.UserID `json:"userID" required:"true"` }
type Notification ¶
type Notification struct {
// contains filtered or unexported fields
}
func NewNotification ¶
func NewNotification(logger *zap.SugaredLogger, repos *repos.Repos) *Notification
NewNotification returns a new Notification service.
func (*Notification) CreateNotification ¶
func (n *Notification) CreateNotification(ctx context.Context, d models.DBTX, params *NotificationCreateParams) (*models.UserNotification, error)
Create creates a new notification. In case of global notifications returns a single one from the fan out.
func (*Notification) LatestNotifications ¶
func (n *Notification) LatestNotifications(ctx context.Context, d models.DBTX, params *models.GetUserNotificationsParams) ([]models.GetUserNotificationsRow, error)
LatestNotifications gets user notifications ordered by creation date.
func (*Notification) PaginatedUserNotifications ¶
func (n *Notification) PaginatedUserNotifications(ctx context.Context, d models.DBTX, userID models.UserID, params models.GetPaginatedNotificationsParams) ([]models.UserNotification, error)
PaginatedUserNotifications gets user notifications by cursor.
type NotificationCreateParams ¶
type NotificationCreateParams struct { models.NotificationCreateParams ReceiverRole *models.Role `json:"receiverRole"` }
type PaginationParams ¶
type PaginationParams struct {
// contains filtered or unexported fields
}
type PaginationParamsDirection ¶
type PaginationParamsDirection string
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
func NewProject ¶
func NewProject(logger *zap.SugaredLogger, repos *repos.Repos) *Project
NewProject returns a new Project service.
type Role ¶
type Role struct { Description string `json:"description"` Rank int `json:"rank"` Name models.Role `json:"name"` }
Role represents a predefined role that may be required for specific actions regardless of scopes assigned to a user.
type Services ¶
type Services struct { Activity *Activity WorkItemComment *WorkItemComment User *User Project *Project Team *Team DemoWorkItem *DemoWorkItem DemoTwoWorkItem *DemoTwoWorkItem WorkItemTag *WorkItemTag Authorization *Authorization Authentication *Authentication Notification *Notification TimeEntry *TimeEntry WorkItemType *WorkItemType WorkItem *WorkItem }
type Team ¶
type Team struct {
// contains filtered or unexported fields
}
func NewTeam ¶
func NewTeam(logger *zap.SugaredLogger, repos *repos.Repos) *Team
NewTeam returns a new Team service.
func (*Team) ByName ¶
func (t *Team) ByName(ctx context.Context, d models.DBTX, name string, projectID models.ProjectID) (*models.Team, error)
ByName gets a team by name.
func (*Team) Create ¶
func (t *Team) Create(ctx context.Context, d models.DBTX, params *models.TeamCreateParams) (*models.Team, error)
Create creates a new team.
type TimeEntry ¶
type TimeEntry struct {
// contains filtered or unexported fields
}
func NewTimeEntry ¶
func NewTimeEntry(logger *zap.SugaredLogger, repos *repos.Repos) *TimeEntry
NewTimeEntry returns a new TimeEntry service.
func (*TimeEntry) ByID ¶
func (te *TimeEntry) ByID(ctx context.Context, d models.DBTX, id models.TimeEntryID) (*models.TimeEntry, error)
ByID gets a time entry by ID.
func (*TimeEntry) Create ¶
func (te *TimeEntry) Create(ctx context.Context, d models.DBTX, caller CtxUser, params *models.TimeEntryCreateParams) (*models.TimeEntry, error)
Create creates a new time entry.
type TimeEntryUpdateParams ¶
type TimeEntryUpdateParams struct { models.TimeEntryUpdateParams // no need for getters for new field, validate in dedicated validateUpdateParams only. // if it conflicts with base validation, just skip based on validatemode NewField string `json:"newField"` }
*
- TODO:
- xo : new property annotations: no-update, no-create, no-update-json, no-create-json to remove json fields or struct fields from either create or update or both,
- instead of current `private` annotations.
example: extra fields required in services for update (same applies for create)
type User ¶
type User struct {
// contains filtered or unexported fields
}
func NewUser ¶
func NewUser(logger *zap.SugaredLogger, repos *repos.Repos) *User
NewUser returns a new User service.
func (*User) AssignTeam ¶
func (*User) ByEmail ¶
func (u *User) ByEmail(ctx context.Context, d models.DBTX, email string, dbOpts ...models.UserSelectConfigOption) (*models.User, error)
ByEmail gets a user by email.
func (*User) ByExternalID ¶
func (u *User) ByExternalID(ctx context.Context, d models.DBTX, id string, dbOpts ...models.UserSelectConfigOption) (*models.User, error)
ByExternalID gets a user by ExternalID.
func (*User) ByUsername ¶
func (u *User) ByUsername(ctx context.Context, d models.DBTX, username string, dbOpts ...models.UserSelectConfigOption) (*models.User, error)
ByUsername gets a user by username.
func (*User) CreateAPIKey ¶
func (*User) LatestGlobalNotifications ¶
func (u *User) LatestGlobalNotifications(ctx context.Context, d models.DBTX, userID models.UserID) ([]models.GetUserNotificationsRow, error)
TODO.
func (*User) LatestPersonalNotifications ¶
func (u *User) LatestPersonalNotifications(ctx context.Context, d models.DBTX, userID models.UserID) ([]models.UserNotification, error)
TODO.
func (*User) Register ¶
func (u *User) Register(ctx context.Context, d models.DBTX, params UserRegisterParams) (*models.User, error)
Register registers a user. IMPORTANT: for internal use only.
func (*User) Update ¶
func (u *User) Update(ctx context.Context, d models.DBTX, id models.UserID, caller CtxUser, params *models.UpdateUserRequest) (*models.User, error)
Update updates a user. In this case request params are defined in the spec and converted to db params for demo purposes. The same can be achieved excluding fields from db update params via SQL column comments.
type UserRegisterParams ¶
type UserRegisterParams struct { Username string `json:"username"` Email string `json:"email"` FirstName *string `json:"firstName"` LastName *string `json:"lastName"` ExternalID string `json:"externalID"` Scopes []models.Scope `json:"scopes"` Role models.Role `json:"role"` }
NOTE: the most important distinction about repositories is that they represent collections of entities. They do not represent database storage or caching or any number of technical concerns. Repositories represent collections. How you hold those collections is simply an implementation detail. Repo should not be aware of models Role and Scope, its conversion or its default values. That's all for upper layers convenience. e.g roles: entity uses rank internally. Repo should not care about mappings to user-friendly names.
type WorkItem ¶
type WorkItem struct {
// contains filtered or unexported fields
}
func NewWorkItem ¶
func NewWorkItem(logger *zap.SugaredLogger, repos *repos.Repos) *WorkItem
NewWorkItem returns a new WorkItem service with common logic for all project worki tems.
func (*WorkItem) AssignTags ¶
func (w *WorkItem) AssignTags(ctx context.Context, d models.DBTX, workItemID models.WorkItemID, tagIDs []models.WorkItemTagID) error
func (*WorkItem) AssignUsers ¶
func (*WorkItem) Delete ¶
func (w *WorkItem) Delete(ctx context.Context, d models.DBTX, id models.WorkItemID) (*models.WorkItem, error)
Delete deletes a work item by ID.
func (*WorkItem) RemoveAssignedUsers ¶
func (*WorkItem) RemoveTags ¶
func (w *WorkItem) RemoveTags(ctx context.Context, d models.DBTX, workItemID models.WorkItemID, tagIDs []models.WorkItemTagID) error
type WorkItemComment ¶
type WorkItemComment struct {
// contains filtered or unexported fields
}
func NewWorkItemComment ¶
func NewWorkItemComment(logger *zap.SugaredLogger, repos *repos.Repos) *WorkItemComment
NewWorkItemComment returns a new work item comment service.
func (*WorkItemComment) ByID ¶
func (t *WorkItemComment) ByID(ctx context.Context, d models.DBTX, id models.WorkItemCommentID) (*models.WorkItemComment, error)
ByID gets a work item comment by ID.
func (*WorkItemComment) Create ¶
func (t *WorkItemComment) Create(ctx context.Context, d models.DBTX, params *models.WorkItemCommentCreateParams) (*models.WorkItemComment, error)
Create creates a new work item comment.
func (*WorkItemComment) Delete ¶
func (t *WorkItemComment) Delete(ctx context.Context, d models.DBTX, caller CtxUser, id models.WorkItemCommentID) (*models.WorkItemComment, error)
Delete deletes an existing work item comment.
func (*WorkItemComment) Update ¶
func (t *WorkItemComment) Update(ctx context.Context, d models.DBTX, caller CtxUser, id models.WorkItemCommentID, params *models.WorkItemCommentUpdateParams) (*models.WorkItemComment, error)
Update updates an existing work item comment.
type WorkItemCreateParams ¶
type WorkItemCreateParams struct { TagIDs []models.WorkItemTagID `json:"tagIDs" nullable:"false" required:"true"` Members []Member `json:"members" nullable:"false" required:"true"` }
type WorkItemTag ¶
type WorkItemTag struct {
// contains filtered or unexported fields
}
func NewWorkItemTag ¶
func NewWorkItemTag(logger *zap.SugaredLogger, repos *repos.Repos) *WorkItemTag
NewWorkItemTag returns a new WorkItemTag service.
func (*WorkItemTag) ByID ¶
func (wit *WorkItemTag) ByID(ctx context.Context, d models.DBTX, id models.WorkItemTagID) (*models.WorkItemTag, error)
ByID gets a work item tag by ID.
func (*WorkItemTag) ByName ¶
func (wit *WorkItemTag) ByName(ctx context.Context, d models.DBTX, name string, projectID models.ProjectID) (*models.WorkItemTag, error)
ByName gets a work item tag by name.
func (*WorkItemTag) Create ¶
func (wit *WorkItemTag) Create(ctx context.Context, d models.DBTX, caller CtxUser, params *models.WorkItemTagCreateParams) (*models.WorkItemTag, error)
Create creates a new work item tag.
func (*WorkItemTag) Delete ¶
func (wit *WorkItemTag) Delete(ctx context.Context, d models.DBTX, caller CtxUser, id models.WorkItemTagID) (*models.WorkItemTag, error)
Delete deletes a work item tag by ID.
func (*WorkItemTag) Update ¶
func (wit *WorkItemTag) Update(ctx context.Context, d models.DBTX, caller CtxUser, id models.WorkItemTagID, params *models.WorkItemTagUpdateParams) (*models.WorkItemTag, error)
Update updates an existing work item tag.
type WorkItemType ¶
type WorkItemType struct {
// contains filtered or unexported fields
}
func NewWorkItemType ¶
func NewWorkItemType(logger *zap.SugaredLogger, repos *repos.Repos) *WorkItemType
NewWorkItemType returns a new WorkItemType service.
func (*WorkItemType) ByID ¶
func (wit *WorkItemType) ByID(ctx context.Context, d models.DBTX, id models.WorkItemTypeID) (*models.WorkItemType, error)
ByID gets a work item type by ID.
Source Files
¶
- context.go
- otel.go
- repos.go
- service.go
- service_activity.go
- service_admin.go
- service_authentication.go
- service_authorization.go
- service_board.go
- service_kanban_step.go
- service_movie_grpc_demo.go
- service_notification.go
- service_project.go
- service_team.go
- service_time_entry.go
- service_user.go
- service_work_item.go
- service_work_item_comment.go
- service_work_item_project_demo.go
- service_work_item_project_demo_two.go
- service_work_item_tag.go
- service_work_item_type.go
- services.go
- validation.go