service

package
v0.0.0-...-192c46a Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToEventDocumentResponse

func ConvertToEventDocumentResponse(event models.Event) dto.EventDocumentDTOResponse

func ConvertToEventResponse

func ConvertToEventResponse(event models.Event) dto.EventResponses

func ConvertToJobDocumentDTOResponse

func ConvertToJobDocumentDTOResponse(job models.OrgOpenJob) dto.JobDocumentDTOResponse

func ConvertToJobRequest

func ConvertToJobRequest(orgID uint, job dto.JobRequest, categories []models.Category) models.OrgOpenJob

func ConvertToJobResponse

func ConvertToJobResponse(job models.OrgOpenJob) dto.JobResponses

func ConvertToOrgContactRequest

func ConvertToOrgContactRequest(orgID uint, contact dto.OrganizationContactRequest) models.OrganizationContact

func ConvertToOrgRequest

func ConvertToOrgRequest(org dto.OrganizationRequest, contacts []models.OrganizationContact, industries []*models.Industry) models.Organization

func ConvertToOrgResponse

func ConvertToOrgResponse(org models.Organization) dto.OrganizationResponse

func ConvertToPrerequisiteRequest

func ConvertToPrerequisiteRequest(jobID uint, prerequisite dto.PrerequisiteRequest) models.Prerequisite

func ConvertToPrerequisiteResponse

func ConvertToPrerequisiteResponse(prerequisite models.Prerequisite) dto.PrerequisiteResponses

Types

type AuthService

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

func NewAuthService

func NewAuthService(userRepo repository.UserRepository, profileRepo *repository.ProfileRepository, jwtSecret string) *AuthService

func (*AuthService) LogIn

func (s *AuthService) LogIn(email, password string) (string, error)

func (*AuthService) SignUp

func (s *AuthService) SignUp(name, email, password, phone string) (string, error)

type EventService

type EventService interface {
	NewEvent(orgID uint, event dto.NewEventRequest, ctx context.Context, file multipart.File, fileHeader *multipart.FileHeader) error
	SyncEvents() error
	SearchEvents(query dto.SearchQuery, page int, Offset int) (dto.SearchEventResponse, error)
	GetAllEvents() ([]dto.EventResponses, error)
	GetAllEventsByOrgID(orgID uint) ([]dto.EventResponses, error)
	GetEventByID(eventID uint) (*dto.EventResponses, error)
	GetEventByIDwithOrgID(orgID uint, eventID uint) (*dto.EventResponses, error)
	ListAllCategories() (*dto.CategoryListResponse, error)
	GetEventPaginate(page uint) ([]dto.EventDocumentDTOResponse, error)
	GetFirst() (*dto.EventResponses, error)
	CountEvent() (int64, error)
	UpdateEvent(orgID uint, eventID uint, event dto.NewEventRequest, ctx context.Context, file multipart.File, fileHeader *multipart.FileHeader) (*dto.EventResponses, error)
	DeleteEvent(orgID uint, eventID uint) error
	CountEventByOrgID(orgID uint) (int64, error)
}

func NewEventService

func NewEventService(eventRepo repository.EventRepository, db *gorm.DB, os *opensearch.Client, s3 *infrastructure.S3Uploader) EventService

type EventServiceMock

type EventServiceMock struct {
	mock.Mock
}

func NewEventServiceMock

func NewEventServiceMock() *EventServiceMock

func (*EventServiceMock) CountEvent

func (m *EventServiceMock) CountEvent() (int64, error)

func (*EventServiceMock) CountEventByOrgID

func (m *EventServiceMock) CountEventByOrgID(orgID uint) (int64, error)

func (*EventServiceMock) DeleteEvent

func (m *EventServiceMock) DeleteEvent(orgID uint, eventID uint) error

func (*EventServiceMock) GetAllEvents

func (m *EventServiceMock) GetAllEvents() ([]dto.EventResponses, error)

func (*EventServiceMock) GetAllEventsByOrgID

func (m *EventServiceMock) GetAllEventsByOrgID(orgID uint) ([]dto.EventResponses, error)

func (*EventServiceMock) GetEventByID

func (m *EventServiceMock) GetEventByID(eventID uint) (*dto.EventResponses, error)

func (*EventServiceMock) GetEventByIDwithOrgID

func (m *EventServiceMock) GetEventByIDwithOrgID(orgID uint, eventID uint) (*dto.EventResponses, error)

func (*EventServiceMock) GetEventPaginate

func (m *EventServiceMock) GetEventPaginate(page uint) ([]dto.EventDocumentDTOResponse, error)

func (*EventServiceMock) GetFirst

func (m *EventServiceMock) GetFirst() (*dto.EventResponses, error)

func (*EventServiceMock) ListAllCategories

func (m *EventServiceMock) ListAllCategories() (*dto.CategoryListResponse, error)

func (*EventServiceMock) NewEvent

func (m *EventServiceMock) NewEvent(orgID uint, req dto.NewEventRequest, ctx context.Context, file multipart.File, fileHeader *multipart.FileHeader) error

func (*EventServiceMock) SearchEvents

func (m *EventServiceMock) SearchEvents(query dto.SearchQuery, page int, Offset int) (dto.SearchEventResponse, error)

func (*EventServiceMock) SyncEvents

func (m *EventServiceMock) SyncEvents() error

func (*EventServiceMock) UpdateEvent

func (m *EventServiceMock) UpdateEvent(orgID uint, eventID uint, event dto.NewEventRequest, ctx context.Context, file multipart.File, fileHeader *multipart.FileHeader) (*dto.EventResponses, error)

func (*EventServiceMock) UpdateEventPicture

func (m *EventServiceMock) UpdateEventPicture(orgID uint, eventID uint, picURL string) error

type LocationService

type LocationService interface {
	GetAllOrganizationLocation() ([]models.Organization, error)
	GetOrganizationLocationByOrgID(orgID uint) (*models.Organization, error)
	GetAllEventLocation() ([]models.Event, error)
	GetEventLocationByEventID(eventID uint) (*models.Event, error)
	GetEventLocationByOrgID(orgID uint) ([]models.Event, error)
}

type OauthService

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

func NewOauthService

func NewOauthService(userRepo repository.UserRepository, profileRepo *repository.ProfileRepository, jwtSecret string) *OauthService

func (*OauthService) AuthenticateUser

func (s *OauthService) AuthenticateUser(name, email, provider, providerID string) (string, error)

type OrgOpenJobService

type OrgOpenJobService interface {
	SyncJobs() error
	SearchJobs(query dto.SearchJobQuery, page int, Offset int) (dto.SearchJobResponse, error)
	NewJob(orgID uint, dto dto.JobRequest) error
	ListAllJobs() ([]dto.JobResponses, error)
	GetAllJobsByOrgID(OrgId uint) ([]dto.JobResponses, error)
	GetJobByID(jobID uint) (*dto.JobResponses, error)
	GetJobByIDwithOrgID(orgID uint, jobID uint) (*dto.JobResponses, error)
	GetJobPaginate(page uint) ([]dto.JobDocumentDTOResponse, error)
	UpdateJob(orgID uint, jobID uint, dto dto.JobRequest) (*dto.JobResponses, error)
	UpdateJobPicture(orgID uint, jobID uint, picURL string) error
	RemoveJob(jobID uint) error
	CountsByOrgID(orgID uint) (int64, error)
	NewPrerequisite(jobID uint, dto dto.PrerequisiteRequest) error
	GetPrerequisiteByID(prerequisiteID uint) (*dto.PrerequisiteResponses, error)
	GetAllPrerequisitesBelongToJobs(jobID uint) ([]dto.PrerequisiteResponses, error)
	GetAllPrerequisites() ([]dto.PrerequisiteResponses, error)
	UpdatePrerequisite(jobID uint, prerequisiteID uint, dto dto.PrerequisiteRequest) (*dto.PrerequisiteResponses, error)
	RemovePrerequisite(prerequisiteID uint) error
}

func NewOrgOpenJobService

func NewOrgOpenJobService(jobRepo repository.OrgOpenJobRepository, OrgRepo repository.OrganizationRepository, PreqRepo repository.PrerequisiteRepository, db *gorm.DB, os *opensearch.Client, s3 *infrastructure.S3Uploader) OrgOpenJobService

Constructor

type OrganizationContactService

type OrganizationContactService interface {
	CreateContact(orgID uint, org dto.OrganizationContactRequest) error
	GetContactByID(orgID uint, id uint) (*dto.OrganizationContactResponses, error)
	GetAllContactsByOrgID(orgID uint) ([]dto.OrganizationContactResponses, error)
	UpdateContact(orgID uint, contactID uint, org dto.OrganizationContactRequest) (*dto.OrganizationContactResponses, error)
	DeleteContact(orgID uint, id uint) error
}

type OrganizationService

type OrganizationService interface {
	CreateOrganization(userID uuid.UUID, org dto.OrganizationRequest, ctx context.Context, file multipart.File, fileHeader *multipart.FileHeader, file2 multipart.File, file2Header *multipart.FileHeader) error
	ListAllOrganizations() ([]dto.OrganizationResponse, error)
	ListAllIndustries() (dto.IndustryListResponse, error)
	GetOrganizationByID(orgID uint) (*dto.OrganizationResponse, error)
	GetPaginateOrganization(page uint) ([]dto.OrganizationResponse, error)
	UpdateOrganization(orgID uint, org dto.OrganizationRequest, ctx context.Context, file multipart.File, fileHeader *multipart.FileHeader, file2 multipart.File, file2Header *multipart.FileHeader) (*dto.OrganizationResponse, error)
	UpdateOrganizationStatus(orgID uint, status string) error
	UpdateOrganizationBackgroundPicture(id uint, picURL string) error
	UpdateOrganizationPicture(id uint, picURL string) error
	DeleteOrganization(orgID uint) error
}

type PolicyRoleService

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

func NewPolicyService

func NewPolicyService(enforcer *casbin.Enforcer) *PolicyRoleService

func (*PolicyRoleService) AddPoliciesForRoleInDomain

func (p *PolicyRoleService) AddPoliciesForRoleInDomain(role string, domain string, policies []repository.Policy) (bool, error)

func (*PolicyRoleService) AddPolicyForRoleInDomain

func (p *PolicyRoleService) AddPolicyForRoleInDomain(role string, domain string, obj string, action string) (bool, error)

func (*PolicyRoleService) DeletePoliciesForRoleInDomain

func (p *PolicyRoleService) DeletePoliciesForRoleInDomain(role string, domain string, policies []repository.Policy) (bool, error)

func (*PolicyRoleService) DeletePolicyForRoleInDomain

func (p *PolicyRoleService) DeletePolicyForRoleInDomain(obj string, domain string, action string, role string) (bool, error)

func (*PolicyRoleService) GetPoliciesForRoleInDomain

func (p *PolicyRoleService) GetPoliciesForRoleInDomain(role string, domain string) ([][]string, error)

func (*PolicyRoleService) GetRolesForPolicyInDomain

func (p *PolicyRoleService) GetRolesForPolicyInDomain(domain string, obj string, action string) ([][]string, error)

type RoleService

type RoleService interface {
	Invitation(inviterUserID uuid.UUID, invitedEmail string, orgID uint) (bool, error)
	CallBackToken(token uuid.UUID) (bool, error)
	EditRole(userID uuid.UUID, targetUserID uuid.UUID, orgID uint, role string) (bool, error)
	DeleteMember(userID uuid.UUID, targetUserID uuid.UUID, orgID uint) (bool, error)
	GetAllUsersWithRoleByDomain(orgID uint) ([]models.RoleInOrganization, error)
	GetRolesForUserInDomain(userID uuid.UUID, orgID uint) (*models.RoleInOrganization, error)
	DeleteDomains(orgID uint) (bool, error)
	GetDomainsByUser(uuid uuid.UUID) ([]models.Organization, error)
	UpdateRoleToEnforcer() (bool, error)
	CountByOrgID(orgID uint) (int64, error)
}

func NewRoleWithDomainService

func NewRoleWithDomainService(dbRoleRepository models.RoleRepository,
	enforcerRoleRepository repository.EnforcerRoleRepository,
	userRepository repository.UserRepository,
	organizationRepository repository.OrganizationRepository,
	inviteTokenRepository models.InviteTokenRepository,
	inviteMailRepository repository.MailRepository) RoleService

type RoleWithDomainService

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

func (RoleWithDomainService) CallBackToken

func (r RoleWithDomainService) CallBackToken(token uuid.UUID) (bool, error)

func (RoleWithDomainService) CountByOrgID

func (r RoleWithDomainService) CountByOrgID(orgID uint) (int64, error)

func (RoleWithDomainService) DeleteDomains

func (r RoleWithDomainService) DeleteDomains(orgID uint) (bool, error)

func (RoleWithDomainService) DeleteMember

func (r RoleWithDomainService) DeleteMember(editorUserID uuid.UUID, targetUserID uuid.UUID, orgID uint) (bool, error)

func (RoleWithDomainService) EditRole

func (r RoleWithDomainService) EditRole(editorUserID uuid.UUID, targetUserID uuid.UUID, orgID uint, role string) (bool, error)

func (RoleWithDomainService) GetAllUsersWithRoleByDomain

func (r RoleWithDomainService) GetAllUsersWithRoleByDomain(orgID uint) ([]models.RoleInOrganization, error)

func (RoleWithDomainService) GetDomainsByUser

func (r RoleWithDomainService) GetDomainsByUser(uuid uuid.UUID) ([]models.Organization, error)

func (RoleWithDomainService) GetRolesForUserInDomain

func (r RoleWithDomainService) GetRolesForUserInDomain(userID uuid.UUID, orgID uint) (*models.RoleInOrganization, error)

func (RoleWithDomainService) Invitation

func (r RoleWithDomainService) Invitation(inviterUserID uuid.UUID, invitedEmail string, orgID uint) (bool, error)

func (RoleWithDomainService) UpdateRoleToEnforcer

func (r RoleWithDomainService) UpdateRoleToEnforcer() (bool, error)

type UserInteractEventService

type UserInteractEventService interface {
	IncrementUserInteractForEvent(userID uuid.UUID, eventID uint) error
	FindInteractedEventByUserID(userID uuid.UUID) (*dto.EventsAreInteractedByUserResponse, error)
	GetAll() ([]dto.UserInteractEventResponse, error)
	FindUserCategoriesStatsByUserID(userID uuid.UUID) (*dto.UserInteractCategoriesResponse, error)
	GetAllUserCategoriesStats() ([]dto.UserInteractCategoriesResponse, error)
	GetAllInteractedEventPerUser() ([]dto.EventsAreInteractedByUserResponse, error)
}

func NewUserInteractEventService

func NewUserInteractEventService(userInteractEventRepo repository.UserInteractEventRepository) UserInteractEventService

type UserInteractService

type UserInteractService interface {
	IncrementUserInteractForEvent(userID uuid.UUID, eventID uint) error
	FindByUserID(userID uuid.UUID) ([]dto.UserInteractResponse, error)
	GetAll() ([]dto.UserInteractResponse, error)
	FindCategoryByIds(catIDs uint) ([]dto.UserInteractResponse, error)
}

func NewUserInteractService

func NewUserInteractService(userInteractRepo repository.UserInteractRepository) UserInteractService

type UserPreferenceService

type UserPreferenceService interface {
	CreateUserPreference(userID uuid.UUID, req dto.UserPreferenceRequest) error
	GetUserPreference(userID uuid.UUID) (dto.UserPreferenceResponse, error)
	ListUserPreferences() (dto.UserPreferenceTrainingResponses, error)
	ListEventTrainingPreference() (dto.EventTrainingRespoonses, error)
	UpdateUserPreference(userID uuid.UUID, req dto.UserPreferenceRequest) (dto.UserPreferenceResponse, error)
	DeleteUserPreference(userID uuid.UUID) error
}

type UserService

type UserService interface {
	CreateUser(user *models.User) error
	ListUsers() ([]dto.UserResponses, error)
	GetCurrentUserProfile(userId uuid.UUID) (*dto.ProfileResponses, error)
	UpdateUserPicture(ctx context.Context, userID uuid.UUID, file multipart.File, fileHeader *multipart.FileHeader) (string, error)
}

func NewUserService

func NewUserService(userRepo repository.UserRepository, s3Uploader *infrastructure.S3Uploader) UserService

Jump to

Keyboard shortcuts

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