Documentation
¶
Index ¶
- Variables
- type Canevas
- type CanevasData
- type CanevasPointDeControle
- type CirconstanceInspection
- type Commentaire
- type Constat
- type Departement
- type Etablissement
- type EtablissementToExploitant
- type EtatInspection
- type Evenement
- type File
- type FindEtablissementResults
- type Inspection
- type InspectionToInspecteur
- type Message
- type Notification
- type OrigineInspection
- type PieceJointe
- type PointDeControle
- type Profil
- type Rapport
- type RegimeEtablissement
- type RenderedTemplate
- type Suite
- type Theme
- type TypeConstat
- type TypeEvenement
- type TypeInspection
- type TypeSuite
- type User
- type UserToFavori
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSuiteManquante = errors.NewErrBadInput("Pas de suite") ErrConstatManquant = errors.NewErrBadInput("Un constat est manquant") ErrPointDeControleNonPublie = errors.NewErrBadInput("Un point de contrôle n'est pas publié") ErrPresenceConstatNonConforme = errors.NewErrBadInput("Un constat n'est pas conforme") ErrAbsenceConstatNonConforme = errors.NewErrBadInput("Aucun constat n'est non-conforme") )
Functions ¶
This section is empty.
Types ¶
type CanevasData ¶
type CanevasData struct {
PointsDeControle []CanevasPointDeControle `json:"points_de_controle"`
}
type CanevasPointDeControle ¶
type CirconstanceInspection ¶
type CirconstanceInspection string
const ( CirconstanceIncident CirconstanceInspection = "incident" CirconstancePlainte CirconstanceInspection = "plainte" CirconstanceAutre CirconstanceInspection = "autre" )
type Commentaire ¶
type Commentaire struct {
Id int64 `json:"id"`
Message string `json:"message"`
Date time.Time `json:"date"`
AuteurId int64 `json:"-" sql:",notnull"`
InspectionId int64 `json:"-" sql:",notnull"`
Auteur *User `json:"auteur,omitempty"`
Inspection *Inspection `json:"-"`
PiecesJointes []PieceJointe `json:"pieces_jointes,omitempty"`
}
type Constat ¶
type Constat struct {
Id int64 `json:"id"`
Type TypeConstat `json:"type"`
Remarques string `json:"remarques"`
DateResolution types.NullTime `json:"date_resolution" sql:"type:timestamptz"`
EcheanceResolution util.DateString `json:"echeance_resolution,omitempty" sql:"type:date"`
DelaiNombre int32 `json:"delai_nombre"`
DelaiUnite string `json:"delai_unite"`
NotificationRappelEcheanceEnvoyee bool `json:"_" sql:",notnull,default:false"`
NotificationEcheanceExpireeEnvoyee bool `json:"_" sql:",notnull,default:false"`
}
type Departement ¶
type Departement struct {
Id int64 `json:"id"`
CodeInsee string `json:"code_insee" sql:",unique,notnull"`
Nom string `json:"nom"`
Charniere string `json:"charniere"`
Region string `json:"region"`
CharniereRegion string `json:"charniere_region"`
}
func (Departement) AvecCharniere ¶
func (d Departement) AvecCharniere() string
func (Departement) RegionAvecCharniere ¶
func (d Departement) RegionAvecCharniere() string
type Etablissement ¶
type Etablissement struct {
Id int64 `json:"id"`
S3IC string `json:"s3ic" sql:",unique"`
Nom string `json:"nom"`
Raison string `json:"raison"`
Seveso string `json:"seveso"`
Activite string `json:"activite"`
Iedmtd bool `json:"iedmtd" sql:",notnull"`
Adresse1 string `json:"adresse1"`
Adresse2 string `json:"adresse2"`
CodePostal string `json:"code_postal"`
Commune string `json:"commune"`
Regime RegimeEtablissement `json:"regime"`
DepartementId int64 `json:"-"`
Exploitants []User `pg:"many2many:etablissement_to_exploitants" json:"exploitants,omitempty"`
Inspections []Inspection `json:"inspections,omitempty"`
Departement *Departement `json:"departement,omitempty"`
}
type EtablissementToExploitant ¶
type EtablissementToExploitant struct {
EtablissementId int64 `sql:",pk"`
UserId int64 `sql:",pk"`
Etablissement *Etablissement
User *User
}
type EtatInspection ¶
type EtatInspection string
const ( EtatInconnu EtatInspection = "inconnu" EtatPreparation EtatInspection = "preparation" EtatEnCours EtatInspection = "en_cours" EtatAttenteValidation EtatInspection = "attente_validation" EtatTraitementNonConformites EtatInspection = "traitement_non_conformites" EtatClos EtatInspection = "close" )
type Evenement ¶
type Evenement struct {
Id int64 `json:"id"`
Type TypeEvenement `json:"type"`
CreatedAt time.Time `json:"created_at"`
Data map[string]interface{} `json:"data" sql:"type:jsonb"`
AuteurId int64 `json:"auteur_id" sql:",notnull"`
InspectionId int64 `json:"inspection_id" sql:",notnull"`
Auteur *User `json:"auteur,omitempty"`
Inspection *Inspection `json:"-"`
}
type FindEtablissementResults ¶
type FindEtablissementResults struct {
Etablissements []Etablissement `json:"etablissements"`
Total int `json:"total"`
}
type Inspection ¶
type Inspection struct {
Id int64 `json:"id"`
Date util.DateString `json:"date" sql:"type:date"`
Type TypeInspection `json:"type"`
Annonce bool `json:"annonce" sql:",notnull,default:false"`
Origine OrigineInspection `json:"origine"`
Circonstance CirconstanceInspection `json:"circonstance"`
DetailCirconstance string `json:"detail_circonstance"`
Contexte string `json:"contexte"`
Etat EtatInspection `json:"etat"`
EtablissementId int64 `json:"etablissement_id" sql:",notnull"`
Themes []string `json:"themes" sql:",array"`
SuiteId int64 `json:"-" sql:"on_delete:SET NULL"`
DateValidation types.NullTime `json:"date_validation" sql:"type:timestamptz"`
RapportId int64 `json:"-" sql:"on_delete:SET NULL"`
ValidationRejetee bool `json:"validation_rejetee,omitempty" sql:",notnull,default:false"`
MotifRejetValidation string `json:"motif_rejet_validation,omitempty"`
PersonnesRencontrees string `json:"personnes_rencontrees"`
Commentaires []Commentaire `json:"commentaires,omitempty"`
Etablissement *Etablissement `json:"etablissement,omitempty"`
Inspecteurs []User `pg:"many2many:inspection_to_inspecteurs" json:"inspecteurs,omitempty"`
PointsDeControle []PointDeControle `json:"points_de_controle,omitempty"`
Suite *Suite `json:"suite,omitempty"`
Evenements []Evenement `json:"evenements,omitempty"`
Rapport *Rapport `json:"rapport,omitempty"`
NbMessagesNonLus int `json:"nb_messages_non_lus" sql:"-"`
NbNonConformitesAResoudre int `json:"nb_non_conformites_a_resoudre" sql:"-"`
CanevasId int64 `json:"canevas_id" sql:"-"`
PrecedenteInspectionId int64 `json:"precedente_inspection_id" sql:"-"`
}
func (*Inspection) CheckCoherenceSuiteConstats ¶
func (inspection *Inspection) CheckCoherenceSuiteConstats() error
type InspectionToInspecteur ¶
type InspectionToInspecteur struct {
InspectionId int64 `sql:",pk"`
UserId int64 `sql:",pk"`
Inspection *Inspection
User *User
}
type Message ¶
type Message struct {
Id int64 `json:"id"`
Message string `json:"message"`
Date time.Time `json:"date"`
Lu bool `json:"lu" sql:",notnull,default:false"`
Interne bool `json:"interne" sql:",notnull,default:false"`
AuteurId int64 `json:"-" sql:",notnull"`
PointDeControleId int64 `json:"-" sql:",notnull"`
EtapeTraitementNonConformites bool `json:"etape_traitement_non_conformites" sql:",notnull,default:false"`
Auteur *User `json:"auteur,omitempty"`
PointDeControle *PointDeControle `json:"-"`
PiecesJointes []PieceJointe `json:"pieces_jointes,omitempty"`
}
type Notification ¶
type OrigineInspection ¶
type OrigineInspection string
const ( OriginePlanControle OrigineInspection = "plan_de_controle" OrigineCirconstancielle OrigineInspection = "circonstancielle" )
type PieceJointe ¶
type PieceJointe struct {
Id int64 `json:"id"`
Nom string `json:"nom"`
Type string `json:"type"`
Taille int64 `json:"taille"`
StorageId string `json:"-" sql:",unique"`
MessageId int64 `json:"-"`
CommentaireId int64 `json:"-"`
AuteurId int64 `json:"-" sql:",notnull"`
Message *Message `json:"-"`
Commentaire *Commentaire `json:"-"`
Auteur *User `json:"-"`
}
type PointDeControle ¶
type PointDeControle struct {
Id int64 `json:"id"`
Sujet string `json:"sujet"`
ReferencesReglementaires []string `json:"references_reglementaires" sql:",array"`
Publie bool `json:"publie" sql:",notnull,default:false"`
InspectionId int64 `json:"-" sql:",notnull"`
DeletedAt time.Time `json:"-" pg:",soft_delete"`
ConstatId int64 `json:"-" sql:"on_delete:SET NULL"`
Order int64 `json:"order"`
Inspection *Inspection `json:"-"`
Constat *Constat `json:"constat,omitempty"`
Messages []Message `json:"messages,omitempty"`
}
type RegimeEtablissement ¶
type RegimeEtablissement string
const ( RegimeAucun RegimeEtablissement = "aucun" RegimeAutorisation RegimeEtablissement = "autorisation" RegimeDeclaration RegimeEtablissement = "declaration" RegimeEnregistrement RegimeEtablissement = "enregistrement" RegimeInconnu RegimeEtablissement = "inconnu" )
func RegimeFromString ¶
func RegimeFromString(regime string) RegimeEtablissement
type RenderedTemplate ¶
type TypeConstat ¶
type TypeConstat string
const ( TypeConstatInconnu TypeConstat = "inconnu" TypeConstatObservation TypeConstat = "observation" TypeConstatConforme TypeConstat = "conforme" TypeConstatNonConforme TypeConstat = "non_conforme" )
type TypeEvenement ¶
type TypeEvenement string
const ( EvenementCreationMessage TypeEvenement = "message" EvenementCreationCommentaire TypeEvenement = "commentaire" EvenementLectureMessage TypeEvenement = "lecture_message" EvenementCommentaireGeneral TypeEvenement = "commentaire_general" EvenementCreationInspection TypeEvenement = "creation_inspection" EvenementModificationInspection TypeEvenement = "modification_inspection" EvenementPublicationInspection TypeEvenement = "publication_inspection" EvenementDemandeValidationInspection TypeEvenement = "demande_validation_inspection" EvenementRejetValidationInspection TypeEvenement = "rejet_validation_inspection" EvenementValidationInspection TypeEvenement = "validation_inspection" EvenementClotureInspection TypeEvenement = "cloture_inspection" EvenementCreationPointDeControle TypeEvenement = "creation_point_de_controle" EvenementModificationPointDeControle TypeEvenement = "modification_point_de_controle" EvenementSuppressionPointDeControle TypeEvenement = "suppression_point_de_controle" EvenementPublicationPointDeControle TypeEvenement = "publication_point_de_controle" EvenementCreationConstat TypeEvenement = "creation_constat" EvenementModificationConstat TypeEvenement = "modification_constat" EvenementSuppressionConstat TypeEvenement = "suppression_constat" EvenementResolutionConstat TypeEvenement = "resolution_constat" EvenementCreationSuite TypeEvenement = "creation_suite" EvenementModificationSuite TypeEvenement = "modification_suite" EvenementSuppressionSuite TypeEvenement = "suppression_suite" )
type TypeInspection ¶
type TypeInspection string
const ( TypeApprofondi TypeInspection = "approfondi" TypeCourant TypeInspection = "courant" TypePonctuel TypeInspection = "ponctuel" )
type User ¶
type User struct {
Id int64 `json:"id"`
Nom string `json:"nom"`
Prenom string `json:"prenom"`
Email string `json:"email" sql:",unique"`
Profile Profil `json:"profile"`
}
func (*User) AsRecipient ¶
type UserToFavori ¶
type UserToFavori struct {
InspectionId int64 `sql:",pk"`
UserId int64 `sql:",pk"`
Inspection *Inspection
User *User
}
Click to show internal directories.
Click to hide internal directories.