Documentation
¶
Index ¶
- Variables
- type Config
- type EmailService
- type InspectionEcheancesProches
- type InspectionExpirationDelais
- type InspectionFilter
- type Lettre
- type ListEtablissementsFilter
- type ListInspectionsFilter
- type ListNotificationsFilter
- type ListUsersFilters
- type NouveauMessage
- type NouveauxMessagesUser
- type Person
- type Rapport
- type RecapValidationInspection
- type RenderedTemplate
- type Repository
- type Service
- func (s *Service) AddFavoriToInspection(ctx *UserContext, idInspection int64) error
- func (s *Service) AskValidateInspection(ctx *UserContext, idInspection int64) error
- func (s *Service) CloreInspection(ctx *UserContext, idInspection int64) error
- func (s *Service) CreateCanevas(ctx *UserContext, idInspection int64, canevas models.Canevas) (int64, error)
- func (s *Service) CreateCommentaire(ctx *UserContext, idInspection int64, commentaire models.Commentaire) (int64, error)
- func (s *Service) CreateConstat(ctx *UserContext, idPointDeControle int64, constat models.Constat) (int64, error)
- func (s *Service) CreateInspection(ctx *UserContext, inspection models.Inspection) (int64, error)
- func (s *Service) CreateMessage(ctx *UserContext, idPointDeControle int64, message models.Message) (int64, error)
- func (s *Service) CreatePieceJointe(ctx *UserContext, pieceJointeFile models.File) (int64, error)
- func (s *Service) CreatePointDeControle(ctx *UserContext, idInspection int64, pointDeControle models.PointDeControle) (int64, error)
- func (s *Service) CreateSuite(ctx *UserContext, idInspection int64, suite models.Suite) (int64, error)
- func (s *Service) CreateTheme(ctx *UserContext, theme models.Theme) (int64, error)
- func (s *Service) DeleteCanevas(ctx *UserContext, idCanevas int64) error
- func (s *Service) DeleteConstat(ctx *UserContext, idPointDeControle int64) error
- func (s *Service) DeletePointDeControle(ctx *UserContext, idPointDeControle int64) error
- func (s *Service) DeleteSuite(ctx *UserContext, idInspection int64) error
- func (s *Service) DeleteTheme(ctx *UserContext, idTheme int64) error
- func (s *Service) GenererLettreAnnonce(ctx *UserContext, idInspection int64) (*models.File, error)
- func (s *Service) GenererLettreSuite(ctx *UserContext, idInspection int64) (*models.File, error)
- func (s *Service) GenererRapport(ctx *UserContext, idInspection int64) (*models.File, error)
- func (s *Service) GetEtablissement(ctx *UserContext, id int64) (*models.Etablissement, error)
- func (s *Service) GetInspection(ctx *UserContext, id int64) (*models.Inspection, error)
- func (s *Service) GetPieceJointe(ctx *UserContext, idPieceJointe int64) (*models.File, error)
- func (s *Service) GetRapport(ctx *UserContext, idInspection int64) (*models.File, error)
- func (s *Service) LireMessage(ctx *UserContext, idMessage int64) error
- func (s *Service) LireNotifications(ctx *UserContext, ids []int64) error
- func (s *Service) ListCanevas(ctx *UserContext) ([]models.Canevas, error)
- func (s *Service) ListEtablissements(ctx *UserContext, filter ListEtablissementsFilter) (*models.FindEtablissementResults, error)
- func (s *Service) ListInspections(ctx *UserContext, filter ListInspectionsFilter) ([]models.Inspection, error)
- func (s *Service) ListInspectionsFavorites(ctx *UserContext) ([]models.Inspection, error)
- func (s *Service) ListNotifications(ctx *UserContext, filter *ListNotificationsFilter) ([]models.Notification, error)
- func (s *Service) ListThemes(ctx *UserContext) ([]models.Theme, error)
- func (s *Service) ListUsers(ctx *UserContext, filters ListUsersFilters) ([]models.User, error)
- func (s *Service) OrderPointsDeControle(ctx *UserContext, idInspection int64, pointsDeControleIds []int64) error
- func (s *Service) PublishInspection(ctx *UserContext, idInspection int64) error
- func (s *Service) PublishPointDeControle(ctx *UserContext, idPointDeControle int64) error
- func (s *Service) RejectInspection(ctx *UserContext, idInspection int64, motifRejet string) error
- func (s *Service) RemoveFavoriToInspection(ctx *UserContext, idInspection int64) error
- func (s *Service) ResolveConstat(ctx *UserContext, idPointDeControle int64) error
- func (s *Service) SendEmailsExpirationDelais() error
- func (s *Service) SendEmailsNouveauxMessages() error
- func (s *Service) SendEmailsRappelEcheances() error
- func (s *Service) SendEmailsRecapValidation(idInspection int64) error
- func (s *Service) UpdateConstat(ctx *UserContext, idPointDeControle int64, constat models.Constat) error
- func (s *Service) UpdateInspection(ctx *UserContext, inspection models.Inspection) error
- func (s *Service) UpdatePointDeControle(ctx *UserContext, idPointDeControle int64, ...) error
- func (s *Service) UpdateSuite(ctx *UserContext, idInspection int64, suite models.Suite) error
- func (s *Service) ValidateInspection(ctx *UserContext, idInspection int64, rapportFile models.File) error
- type Storage
- type TemplateService
- type UserContext
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCreationConstatImpossible = errors.NewErrForbidden("Impossible de créer le constat") ErrSuppressionOuModificationConstatImpossible = errors.NewErrForbidden("Impossible de supprimer ou modifier le constat") ErrBesoinEtatTraitementNonConformites = errors.NewErrForbidden("L'inspection doit être à l'étape de traitement des non-conformités") ErrBesoinTypeConstatNonConforme = errors.NewErrForbidden("Impossible de résoudre un constat conforme") )
View Source
var ( // common errors ErrBesoinProfilApprobateur = errors.NewErrForbidden("Il faut être approbateur") ErrBesoinProfilExploitant = errors.NewErrForbidden("Il faut être exploitant") ErrBesoinProfilInspecteur = errors.NewErrForbidden("Il faut être inspecteur") ErrNonAssigneInspection = errors.NewErrForbidden("Il faut être assigné à l'inspection") ErrInvalidInput = errors.NewErrBadInput("Données invalides") )
View Source
var ( ErrInspectionNotFound = errors.NewErrForbidden("Inspection non trouvée") ErrClotureInspectionImpossible = errors.NewErrForbidden("Impossible de clore l'inspection") )
View Source
var ( ErrCreationPointDeControleImpossible = errors.NewErrForbidden("Impossible de créer le point de contrôle") ErrModificationPointDeControleImpossible = errors.NewErrForbidden("Impossible de modifier le point de contrôle") )
View Source
var ( ErrInspecteurNonAffecte = errors.NewErrForbidden("Utilisateur non affecté à cette inspection") ErrCreationSuiteImpossible = errors.NewErrForbidden("Impossible de créer la suite") )
View Source
var (
ErrPieceJointeNotFound = errors.NewErrForbidden("Pièce-jointe non trouvée")
)
View Source
var (
ErrRapportNotFound = errors.NewErrBadInput("Rapport non trouvé")
)
View Source
var (
ErrUserNotFound = errors.NewErrForbidden("Utilisateur non trouvé")
)
View Source
var NotificationsEvenements = make(map[models.TypeEvenement](func(*UserContext) []string))
Functions ¶
This section is empty.
Types ¶
type EmailService ¶
type InspectionEcheancesProches ¶
type InspectionEcheancesProches struct { Destinataire models.User InspectionId int64 `json:"inspection_id"` ConstatId int64 `json:"constat_id"` DateInspection string `json:"date_inspection"` RaisonEtablissement string `json:"raison_etablissement"` AdresseEtablissement string `json:"adresse_etablissement"` }
type InspectionExpirationDelais ¶
type InspectionExpirationDelais struct { Destinataire models.User InspectionId int64 `json:"inspection_id"` ConstatId int64 `json:"constat_id"` DateInspection string `json:"date_inspection"` RaisonEtablissement string `json:"raison_etablissement"` AdresseEtablissement string `json:"adresse_etablissement"` }
type InspectionFilter ¶
type InspectionFilter struct {
OmitPointsDeControleNonPublies bool
}
type Lettre ¶
type Lettre struct { Inspection models.Inspection DateInspection string DateLettre string VilleUnite string DepartementUnite string NomDirection string URLDirection string Prefet string HeureInspection string Auteur Person AutresAuteurs []Person Exploitant Person }
func NewLettre ¶
func NewLettre(inspection *models.Inspection) Lettre
type ListEtablissementsFilter ¶
type ListEtablissementsFilter struct { S3IC string `form:"s3ic"` Nom string `form:"nom"` Adresse string `form:"adresse"` Page int `form:"page"` }
func (*ListEtablissementsFilter) GetPage ¶
func (f *ListEtablissementsFilter) GetPage() int
type ListInspectionsFilter ¶
type ListInspectionsFilter struct {
Assigned bool `form:"assigned"`
}
type ListNotificationsFilter ¶
type ListNotificationsFilter struct {
Lue bool `form:"lue" default:"false"`
}
type ListUsersFilters ¶
type NouveauMessage ¶
type NouveauMessage struct { DateInspection string `json:"date_inspection"` NomAuteur string `json:"nom_auteur"` RaisonEtablissement string `json:"raison_etablissement"` SujetPointDeControle string `json:"sujet_point_de_controle"` Message string `json:"message"` DateMessage string `json:"date_message"` InspectionId int64 `json:"inspection_id"` PointDeControleId int64 `json:"point_de_controle_id"` MessageId int64 `json:"message_id"` }
type NouveauxMessagesUser ¶
type NouveauxMessagesUser struct { Destinataire models.User Messages []NouveauMessage }
type Rapport ¶
type Rapport struct { Inspection models.Inspection DateInspection string DateRapport string VilleUnite string DepartementUnite string NomDirection string URLDirection string Prefet string Auteur Person AutresAuteurs []Person Exploitant Person }
func NewRapport ¶
func NewRapport(inspection *models.Inspection) Rapport
type RecapValidationInspection ¶
type RecapValidationInspection struct { Destinataire models.User InspectionId int64 `json:"inspection_id"` DateInspection string `json:"date_inspection"` RaisonEtablissement string `json:"raison_etablissement"` AdresseEtablissement string `json:"adresse_etablissement"` NonConformites bool `json:"non_conformites"` }
type RenderedTemplate ¶
type Repository ¶
type Repository interface { FindEtablissements(ctx *UserContext, filter ListEtablissementsFilter) (*models.FindEtablissementResults, error) GetEtablissementByID(ctx *UserContext, id int64) (*models.Etablissement, error) ListThemes() ([]models.Theme, error) CreateTheme(ctx *UserContext, theme models.Theme) (int64, error) DeleteTheme(ctx *UserContext, idTheme int64) error ListCanevas() ([]models.Canevas, error) GetCanevasByID(id int64) (*models.Canevas, error) CreateCanevas(ctx *UserContext, idInspection int64, canevas models.Canevas) (int64, error) DeleteCanevas(ctx *UserContext, idCanevas int64) error ListInspections(ctx *UserContext, filter ListInspectionsFilter) ([]models.Inspection, error) ListInspectionsFavorites(ctx *UserContext) ([]models.Inspection, error) ListInspectionsExpirationDelais() ([]InspectionExpirationDelais, error) ListInspectionsEcheancesProches(seuilRappelEcheancservicees float32) ([]InspectionEcheancesProches, error) CreateInspection(ctx *UserContext, inspection models.Inspection) (int64, error) UpdateInspection(ctx *UserContext, inspection models.Inspection) error GetInspectionByID(ctx *UserContext, id int64, filter InspectionFilter) (*models.Inspection, error) ImportCanevas(ctx *UserContext, inspectionId int64, canevas models.Canevas) error ImportPointsDeControlesNonConformes(ctx *UserContext, inspectionId int64, previousInspectionId int64) error CheckEtatInspection(idInspection int64, etats []models.EtatInspection) (bool, error) GetEtatInspectionByPointDeControleID(idPointDeControle int64) (models.EtatInspection, error) CheckInspectionHasNonConformites(idInspection int64) (bool, error) GetInspectionTypesConstatsSuiteByID(idInspection int64) (*models.Inspection, error) GetRecapsValidation(idInspection int64) ([]RecapValidationInspection, error) CanCloreInspection(ctx *UserContext, idInspection int64) error ValidateInspection(id int64, etatCible models.EtatInspection) error RejectInspection(id int64, motifRejet string) error UpdateEtatInspection(ctx *UserContext, id int64, etat models.EtatInspection) error AddFavoriToInspection(ctx *UserContext, idInspection int64) error RemoveFavoriToInspection(ctx *UserContext, idInspection int64) error CheckCanCreateSuite(ctx *UserContext, idInspection int64) error CheckCanDeleteSuite(ctx *UserContext, idInspection int64) (bool, error) CreateRapport(idInspection int64, rapport models.Rapport) error GetRapport(ctx *UserContext, idInspection int64) (*models.Rapport, error) CreateSuite(ctx *UserContext, idInspection int64, suite models.Suite) (int64, error) UpdateSuite(ctx *UserContext, idInspection int64, suite models.Suite) error DeleteSuite(ctx *UserContext, idInspection int64) error CreateCommentaire(ctx *UserContext, idInspection int64, commentaire models.Commentaire) (int64, error) CreatePointDeControle(ctx *UserContext, idInspection int64, pointDeControle models.PointDeControle) (int64, error) UpdatePointDeControle(ctx *UserContext, idPointDeControle int64, pointDeControle models.PointDeControle) error DeletePointDeControle(ctx *UserContext, idPointDeControle int64) error PublishPointDeControle(ctx *UserContext, idPointDeControle int64) error CanCreatePointDeControle(ctx *UserContext, idInspection int64) error CanUpdatePointDeControle(ctx *UserContext, idPointDeControle int64) error OrderPointsDeControle(ctx *UserContext, idInspection int64, pointsDeControleIds []int64) error CreateMessage(ctx *UserContext, idPointDeControle int64, message models.Message) (int64, error) LireMessage(ctx *UserContext, idMessage int64) error CheckUserAllowedMessage(ctx *UserContext, idMessage int64) (bool, error) CheckUserIsRecipient(ctx *UserContext, idMessage int64) (bool, error) CanCreateConstat(ctx *UserContext, idPointDeControle int64) error CanDeleteOrUpdateConstat(ctx *UserContext, idPointDeControle int64) error CreateConstat(ctx *UserContext, idPointDeControle int64, constat models.Constat) (int64, error) UpdateConstat(ctx *UserContext, idPointDeControle int64, constat models.Constat) error DeleteConstat(ctx *UserContext, idPointDeControle int64) error ResolveConstat(ctx *UserContext, idPointDeControle int64) error GetTypeConstatByPointDeControleID(idPointDeControle int64) (models.TypeConstat, error) UpdateNotificationRappelEcheanceEnvoyee(constatsIds []int64) error UpdateNotificationEcheanceExpireeEnvoyee(constatsIds []int64) error GetUserByEmail(email string) (*models.User, error) GetUserByID(id int64) (*models.User, error) CheckUsersInspecteurs(ids []int64) (bool, error) CheckInspecteurAllowedInspection(ctx *UserContext, idInspection int64) error CheckUserAllowedPointDeControle(ctx *UserContext, idPointDeControle int64) (bool, error) FindUsers(filters ListUsersFilters) ([]models.User, error) GetPieceJointe(ctx *UserContext, id int64) (*models.PieceJointe, error) CreatePieceJointe(pieceJointe models.PieceJointe) (int64, error) ListNotifications(ctx *UserContext, filter *ListNotificationsFilter) ([]models.Notification, error) LireNotifications(ctx *UserContext, ids []int64) error CreateEvenement(ctx *UserContext, typeEvenement models.TypeEvenement, idInspection int64, data map[string]interface{}) error ListNouveauxMessages() ([]NouveauxMessagesUser, error) }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(config Config, repo Repository, storage Storage, templateService TemplateService, emailService EmailService) *Service
func (*Service) AddFavoriToInspection ¶
func (s *Service) AddFavoriToInspection(ctx *UserContext, idInspection int64) error
func (*Service) AskValidateInspection ¶
func (s *Service) AskValidateInspection(ctx *UserContext, idInspection int64) error
func (*Service) CloreInspection ¶
func (s *Service) CloreInspection(ctx *UserContext, idInspection int64) error
func (*Service) CreateCanevas ¶
func (*Service) CreateCommentaire ¶
func (s *Service) CreateCommentaire(ctx *UserContext, idInspection int64, commentaire models.Commentaire) (int64, error)
func (*Service) CreateConstat ¶
func (*Service) CreateInspection ¶
func (s *Service) CreateInspection(ctx *UserContext, inspection models.Inspection) (int64, error)
func (*Service) CreateMessage ¶
func (*Service) CreatePieceJointe ¶
func (*Service) CreatePointDeControle ¶
func (s *Service) CreatePointDeControle(ctx *UserContext, idInspection int64, pointDeControle models.PointDeControle) (int64, error)
func (*Service) CreateSuite ¶
func (*Service) CreateTheme ¶
func (*Service) DeleteCanevas ¶
func (s *Service) DeleteCanevas(ctx *UserContext, idCanevas int64) error
func (*Service) DeleteConstat ¶
func (s *Service) DeleteConstat(ctx *UserContext, idPointDeControle int64) error
func (*Service) DeletePointDeControle ¶
func (s *Service) DeletePointDeControle(ctx *UserContext, idPointDeControle int64) error
func (*Service) DeleteSuite ¶
func (s *Service) DeleteSuite(ctx *UserContext, idInspection int64) error
func (*Service) DeleteTheme ¶
func (s *Service) DeleteTheme(ctx *UserContext, idTheme int64) error
func (*Service) GenererLettreAnnonce ¶
func (*Service) GenererLettreSuite ¶
func (*Service) GenererRapport ¶
func (*Service) GetEtablissement ¶
func (s *Service) GetEtablissement(ctx *UserContext, id int64) (*models.Etablissement, error)
func (*Service) GetInspection ¶
func (s *Service) GetInspection(ctx *UserContext, id int64) (*models.Inspection, error)
func (*Service) GetPieceJointe ¶
func (*Service) GetRapport ¶
func (*Service) LireMessage ¶
func (s *Service) LireMessage(ctx *UserContext, idMessage int64) error
func (*Service) LireNotifications ¶
func (s *Service) LireNotifications(ctx *UserContext, ids []int64) error
func (*Service) ListCanevas ¶
func (s *Service) ListCanevas(ctx *UserContext) ([]models.Canevas, error)
func (*Service) ListEtablissements ¶
func (s *Service) ListEtablissements(ctx *UserContext, filter ListEtablissementsFilter) (*models.FindEtablissementResults, error)
func (*Service) ListInspections ¶
func (s *Service) ListInspections(ctx *UserContext, filter ListInspectionsFilter) ([]models.Inspection, error)
func (*Service) ListInspectionsFavorites ¶
func (s *Service) ListInspectionsFavorites(ctx *UserContext) ([]models.Inspection, error)
func (*Service) ListNotifications ¶
func (s *Service) ListNotifications(ctx *UserContext, filter *ListNotificationsFilter) ([]models.Notification, error)
func (*Service) ListThemes ¶
func (s *Service) ListThemes(ctx *UserContext) ([]models.Theme, error)
func (*Service) ListUsers ¶
func (s *Service) ListUsers(ctx *UserContext, filters ListUsersFilters) ([]models.User, error)
func (*Service) OrderPointsDeControle ¶
func (s *Service) OrderPointsDeControle(ctx *UserContext, idInspection int64, pointsDeControleIds []int64) error
func (*Service) PublishInspection ¶
func (s *Service) PublishInspection(ctx *UserContext, idInspection int64) error
func (*Service) PublishPointDeControle ¶
func (s *Service) PublishPointDeControle(ctx *UserContext, idPointDeControle int64) error
func (*Service) RejectInspection ¶
func (s *Service) RejectInspection(ctx *UserContext, idInspection int64, motifRejet string) error
func (*Service) RemoveFavoriToInspection ¶
func (s *Service) RemoveFavoriToInspection(ctx *UserContext, idInspection int64) error
func (*Service) ResolveConstat ¶
func (s *Service) ResolveConstat(ctx *UserContext, idPointDeControle int64) error
func (*Service) SendEmailsExpirationDelais ¶
func (*Service) SendEmailsNouveauxMessages ¶
func (*Service) SendEmailsRappelEcheances ¶
func (*Service) SendEmailsRecapValidation ¶
func (*Service) UpdateConstat ¶
func (*Service) UpdateInspection ¶
func (s *Service) UpdateInspection(ctx *UserContext, inspection models.Inspection) error
func (*Service) UpdatePointDeControle ¶
func (s *Service) UpdatePointDeControle(ctx *UserContext, idPointDeControle int64, pointDeControle models.PointDeControle) error
func (*Service) UpdateSuite ¶
func (*Service) ValidateInspection ¶
type TemplateService ¶
type TemplateService interface { RenderEmailExpirationDelais(data interface{}) (*models.RenderedTemplate, error) RenderEmailNouveauxMessages(data interface{}) (*models.RenderedTemplate, error) RenderEmailRappelEcheances(data interface{}) (*models.RenderedTemplate, error) RenderEmailRecapValidation(data interface{}) (*models.RenderedTemplate, error) RenderODTLettreAnnonce(data interface{}) (*models.RenderedTemplate, error) RenderODTLettreSuite(data interface{}) (*models.RenderedTemplate, error) RenderODTRapport(data interface{}) (*models.RenderedTemplate, error) }
type UserContext ¶
func (*UserContext) IsApprobateur ¶
func (ctx *UserContext) IsApprobateur() bool
func (*UserContext) IsExploitant ¶
func (ctx *UserContext) IsExploitant() bool
func (*UserContext) IsInspecteur ¶
func (ctx *UserContext) IsInspecteur() bool
Source Files
¶
Click to show internal directories.
Click to hide internal directories.