announcement

package
v1.0.68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnouncementService

type AnnouncementService struct {
	// contains filtered or unexported fields
}

func NewAnnouncementService

func NewAnnouncementService(db *gorm.DB, ctx *context.ERPContext) *AnnouncementService

NewAnnouncementService returns a new instance of AnnouncementService.

The service is created by providing a GORM database instance and an ERP context. The ERP context is used for authentication and authorization purposes, while the database instance is used for CRUD (Create, Read, Update, Delete) operations.

func (*AnnouncementService) CreateAnnouncement

func (s *AnnouncementService) CreateAnnouncement(data *models.AnnouncementModel) error

func (*AnnouncementService) DeleteAnnouncement

func (s *AnnouncementService) DeleteAnnouncement(id string) error

DeleteAnnouncement deletes an existing announcement record from the database.

It takes an ID as input and returns an error if the operation fails. The function uses GORM to delete the existing announcement data from the announcements table.

func (*AnnouncementService) FindAllAnnouncements

func (s *AnnouncementService) FindAllAnnouncements(request *http.Request) (paginate.Page, error)

FindAllAnnouncements retrieves a paginated list of announcements associated with a specific company.

It takes an HTTP request as input and returns a paginated Page of AnnouncementModel and an error if the operation fails. The function applies a filter based on the company ID in the request header to further filter the announcements.

func (*AnnouncementService) FindAllAnnouncementsByEmployee

func (s *AnnouncementService) FindAllAnnouncementsByEmployee(request *http.Request, employee *models.EmployeeModel) (paginate.Page, error)

func (*AnnouncementService) GetAnnouncementByID

func (s *AnnouncementService) GetAnnouncementByID(id string) (*models.AnnouncementModel, error)

GetAnnouncementByID retrieves an announcement from the database by ID.

It takes an ID as input and returns an AnnouncementModel and an error. The function uses GORM to retrieve the announcement data from the announcements table. If the operation fails, an error is returned.

func (*AnnouncementService) UpdateAnnouncement

func (s *AnnouncementService) UpdateAnnouncement(id string, data *models.AnnouncementModel) error

UpdateAnnouncement updates an existing announcement record in the database.

It takes an ID and a pointer to an AnnouncementModel as input and returns an error if the operation fails. The function uses GORM to update the existing announcement data in the announcements table.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL