fleet/server/activity/api/new_activity.go
Victor Lyuboslavsky 913a5904c8
Move NewActivity to activity bounded context (#39521)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #38536 

This PR moves all logic to create new activities to activity bounded
context.
The old service and ActivityModule methods are not facades that route to
the new activity bounded context. The facades will be removed in a
subsequent PR.

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.

## Testing

- [x] Added/updated automated tests
- [x] QA'd all new/changed functionality manually

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added webhook support for activity events with configurable endpoint
and enable/disable settings.
* Enhanced automation-initiated activity creation without requiring a
user context.
* Improved activity service architecture with centralized creation and
management.

* **Improvements**
* Refactored activity creation to use a dedicated service layer for
better separation of concerns.
* Added support for host-specific and automation-originated activities.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-25 14:11:03 -06:00

25 lines
611 B
Go

package api
import (
"context"
)
// User represents user information for activity recording.
type User struct {
ID uint
Name string
Email string
Deleted bool
}
// ActivityDetails defines the interface for activity detail types.
type ActivityDetails interface {
ActivityName() string
}
// NewActivityService is for creating activities.
type NewActivityService interface {
// NewActivity creates a new activity record and fires the webhook if configured.
// user can be nil for automation-initiated activities.
NewActivity(ctx context.Context, user *User, activity ActivityDetails) error
}