Class without association

0

I have classes Funcionario{nome: string, idade: int, cargo: string} , FolhaPonto{funcionario: Funcionario, data: date, entrada: time, intervalo: time, retorno: time, saida: time} . The system must not allow a point record ( class FolhaPonto ) with the date of a holiday. For example, this should not be allowed:

FolhaPonto {

   funcionario: AlgumFuncionario,
   data: 07/09/2018,
   entrada: 08:02,
   intervalo: 12:01,
   retorno: 14:05,
   saida: 18:03
}

In this case, the date refers to Independence Day ( September 7 ). To control this I created the class Feriado{descricao: string, inicio: datetime, fim: datetime} . The business rule would be obvious, check if the current day refers to any registered holiday ( The user will subscribe to the holidays ). Now comes the question, I can not figure out who the Feriado class would relate to. At first I thought of a many-to-many relationship: Funcionario{nome: string, idade: int, cargo: string, feriados: List<Feriado>} . But as all holidays will suit all employees, it would be obvious that all employee objects would have a list containing all the holidays. My final conclusion is whether the Feriado class does not relate to anyone. It is a "solitary" class that would only serve to store the holiday data returned via query in the database ( select * from "Feriados" where inicio = '07/09/1822' ).

But I do not know if this is a good practice.

    
asked by anonymous 15.06.2018 / 22:25

0 answers