github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/espaceperso/types.go (about)

     1  package espaceperso
     2  
     3  import (
     4  	"time"
     5  
     6  	dm "github.com/benoitkugler/goACVE/server/core/datamodel"
     7  	rd "github.com/benoitkugler/goACVE/server/core/rawdata"
     8  	"github.com/benoitkugler/goACVE/server/core/utils/joomeo"
     9  	"github.com/benoitkugler/goACVE/server/documents"
    10  	"github.com/benoitkugler/goACVE/server/shared"
    11  )
    12  
    13  // ContrainteWithOrigine ajoute les séjours imposant la contrainte
    14  type ContrainteWithOrigine struct {
    15  	documents.ContrainteDocuments
    16  	Origine rd.Ids `json:"origine"`
    17  }
    18  
    19  type Personne struct {
    20  	IdCrypted      string                     `json:"id_crypted"`
    21  	Prenom         string                     `json:"prenom"`
    22  	NomPrenom      string                     `json:"nom_prenom"`
    23  	Sexe           rd.Sexe                    `json:"sexe"`
    24  	DateNaissance  rd.Date                    `json:"date_naissance"`
    25  	FicheSanitaire LockableFicheSanitaire     `json:"fiche_sanitaire"`
    26  	Vaccins        []documents.PublicDocument `json:"vaccins"`
    27  	Documents      []ContrainteWithOrigine    `json:"documents"`
    28  	IsTemporaire   rd.Bool                    `json:"is_temporaire"`
    29  }
    30  
    31  type LockableFicheSanitaire struct {
    32  	rd.FicheSanitaire
    33  	Locked bool `json:"locked"`
    34  }
    35  
    36  type Coordonnees struct {
    37  	Mail       rd.String `json:"mail"`
    38  	Tels       rd.Tels   `json:"tels"`
    39  	Adresse    rd.String `json:"adresse"`
    40  	CodePostal rd.String `json:"code_postal"`
    41  	Ville      rd.String `json:"ville"`
    42  	Pays       rd.String `json:"pays"`
    43  }
    44  
    45  type Responsable struct {
    46  	Coordonnees
    47  	Prenom          string    `json:"prenom"`
    48  	Sexe            rd.Sexe   `json:"sexe"`
    49  	NomPrenom       string    `json:"nom_prenom"`
    50  	CopiesMails     []string  `json:"copies_mails"`
    51  	SecuriteSociale rd.String `json:"securite_sociale"`
    52  	// y compris le responsable
    53  	DestinatairesOptionnels rd.DestinatairesOptionnels `json:"destinataires_optionnels"`
    54  }
    55  
    56  type CampPlus struct {
    57  	shared.Camp
    58  	Documents     []documents.PublicDocument `json:"documents"`
    59  	MailDirecteur string                     `json:"mail_directeur"`
    60  }
    61  
    62  type ChampsAideEditables struct {
    63  	// L'id n'est pas éditable, mais est requis pour identifier les modifications
    64  	IdCrypted string `json:"id_crypted"`
    65  
    66  	Valeur               rd.Euros `json:"valeur"`
    67  	ParJour              rd.Bool  `json:"par_jour"`
    68  	NbJoursMax           rd.Int   `json:"nb_jours_max"`
    69  	IdParticipantCrypted string   `json:"id_participant_crypted"`
    70  	IdStructureCrypted   string   `json:"id_structure_crypted"`
    71  }
    72  
    73  type Aide struct {
    74  	ChampsAideEditables
    75  	Valid          rd.Bool                  `json:"valid"`
    76  	ValeurComputed rd.Euros                 `json:"valeur_computed"`
    77  	Document       documents.PublicDocument `json:"document"`
    78  }
    79  
    80  type Paiement struct {
    81  	LabelPayeur     rd.String      `json:"label_payeur"`
    82  	Valeur          rd.Euros       `json:"valeur"`
    83  	IsInvalide      rd.Bool        `json:"is_invalide"`
    84  	DateReglement   rd.Time        `json:"date_reglement"`
    85  	ModePaiement    rd.ModePaiment `json:"mode_paiement"`
    86  	IsRemboursement rd.Bool        `json:"is_remboursement"`
    87  }
    88  
    89  type Structureaide struct {
    90  	IdCrypted string    `json:"id_crypted"`
    91  	Nom       rd.String `json:"nom"`
    92  }
    93  
    94  type PublicSondage struct {
    95  	IdCrypted string    `json:"id_crypted"`
    96  	IdCamp    int64     `json:"id_camp"`
    97  	Modified  time.Time `json:"modified"`
    98  	rd.RepSondage
    99  }
   100  
   101  // Définit les types concernés dans les échanges navigateur/serveur
   102  type ContentEspacePerso struct {
   103  	Responsable  Responsable             `json:"responsable"`
   104  	Personnes    map[string]Personne     `json:"personnes"`
   105  	Participants []Participant           `json:"participants"`
   106  	Camps        map[int64]CampPlus      `json:"camps"`
   107  	Messages     []dm.PseudoMessage      `json:"messages"`
   108  	Sondages     map[int64]PublicSondage `json:"sondages"`
   109  }
   110  
   111  // MetaEspacePerso expose les données statiques
   112  type MetaEspacePerso struct {
   113  	ContrainteVaccin      documents.PublicContrainte `json:"contrainte_vaccin"`
   114  	UpdateLimitation      int                        `json:"update_limitation"` // en heures
   115  	MailCentreInscription string                     `json:"mail_centre_inscription"`
   116  }
   117  
   118  // Finances regroupe les données liées à l'établissement d'une facture
   119  type Finances struct {
   120  	Aides          []Aide                   `json:"aides"`
   121  	Structureaides map[string]Structureaide `json:"structure_aides"`
   122  	Paiements      []Paiement               `json:"paiements"`
   123  	EtatFinancier  etatFinancier            `json:"etat_financier"`
   124  	LabelVirement  string                   `json:"label_virement"`
   125  }
   126  
   127  type JoomeoOutput struct {
   128  	UrlSpace string         `json:"url_space"`
   129  	Loggin   string         `json:"loggin"`
   130  	Password string         `json:"password"`
   131  	Albums   []joomeo.Album `json:"albums"`
   132  }
   133  
   134  type InFicheSanitaire struct {
   135  	IdCrypted       string            `json:"id_crypted"`
   136  	FicheSanitaire  rd.FicheSanitaire `json:"fiche_sanitaire"`
   137  	SecuriteSociale string            `json:"securite_sociale"`
   138  }
   139  
   140  type OutFicheSanitaire struct {
   141  	FicheSanitaire  LockableFicheSanitaire `json:"fiche_sanitaire"`
   142  	SecuriteSociale rd.String              `json:"securite_sociale"`
   143  }
   144  
   145  // InCreateDocument contient les ids cryptés
   146  type InCreateDocument struct {
   147  	IdPersonne   string `json:"id_personne"`
   148  	IdContrainte string `json:"id_contrainte"`
   149  }
   150  
   151  // type concret implémentant MessageContenu
   152  type ContenuPerso = dm.ContenuPerso
   153  type ContenuDocument = dm.ContenuDocument
   154  type ContenuPlaceLiberee = dm.ContenuPlaceLiberee
   155  type ContenuAttestation = dm.ContenuAttestation
   156  type ContenuSondage = dm.ContenuSondage
   157  
   158  type EditMessage struct {
   159  	Id      int64     `json:"id"`
   160  	Contenu rd.String `json:"contenu"`
   161  }