Add scouthub-attivit-be
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
export interface TipologicaDto {
|
||||
id: string;
|
||||
nome: string;
|
||||
}
|
||||
|
||||
export interface BaseDto {
|
||||
dataCreazione: Date;
|
||||
dataModifica: Date;
|
||||
utenteModifica: string;
|
||||
}
|
||||
|
||||
export interface BrancaDto extends BaseDto {
|
||||
id: number;
|
||||
nome: string;
|
||||
inizioEta: number | null;
|
||||
fineEta: number | null;
|
||||
colore: string | null;
|
||||
cancellato: boolean;
|
||||
}
|
||||
|
||||
export interface CategoriaDto extends BaseDto {
|
||||
id: number;
|
||||
nome: string;
|
||||
padre: number | null;
|
||||
tipo: TipologicaDto;
|
||||
cancellato: boolean;
|
||||
}
|
||||
|
||||
export interface MaterialeDto extends BaseDto {
|
||||
id: number;
|
||||
nome: string;
|
||||
proprieta: unknown;
|
||||
categoriaList?: CategoriaDto[];
|
||||
cancellato: boolean;
|
||||
}
|
||||
|
||||
export interface ParagrafoDto extends BaseDto {
|
||||
id: number;
|
||||
attivitaId: number;
|
||||
corpo: string;
|
||||
autore: string;
|
||||
tipo: TipologicaDto;
|
||||
ordine: number;
|
||||
}
|
||||
|
||||
export interface PeriodoAnnoDto extends BaseDto {
|
||||
id: number;
|
||||
nome: string;
|
||||
inizioMese: number | null;
|
||||
fineMese: number | null;
|
||||
cancellato: boolean;
|
||||
}
|
||||
|
||||
export interface AttivitaDto extends BaseDto {
|
||||
id: number | null;
|
||||
nome: string;
|
||||
autore: string;
|
||||
padre: number | null;
|
||||
stato: TipologicaDto;
|
||||
brancaList: BrancaDto[];
|
||||
categoriaList: CategoriaDto[];
|
||||
materialeList: MaterialeDto[];
|
||||
paragrafoList: ParagrafoDto[];
|
||||
periodoAnnoList: PeriodoAnnoDto[];
|
||||
}
|
||||
|
||||
export interface SearchObjectDto {
|
||||
id: number | null;
|
||||
nome: string | null;
|
||||
gruppo: string;
|
||||
}
|
||||
|
||||
export interface SearchGroupDto {
|
||||
label: string;
|
||||
objectsList: SearchObjectDto[];
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { AuthContext } from '../middlewares/auth.types';
|
||||
|
||||
declare global {
|
||||
namespace Express {
|
||||
interface Request {
|
||||
auth?: AuthContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
@@ -0,0 +1,58 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const tipologicaSchema = z.object({
|
||||
id: z.string(),
|
||||
nome: z.string(),
|
||||
});
|
||||
|
||||
export const paragrafoInputSchema = z.object({
|
||||
id: z.number().optional(),
|
||||
corpo: z.string().min(1).max(500),
|
||||
// Un paragrafo non ha un autore proprio nell'API/frontend: eredita quello
|
||||
// dell'attivita' se non esplicitamente indicato (vedi attivita.service.ts).
|
||||
autore: z.string().min(1).optional(),
|
||||
tipo: z.object({
|
||||
id: z.string(),
|
||||
}),
|
||||
ordine: z.number().int(),
|
||||
});
|
||||
|
||||
export const brancaInputSchema = z.object({
|
||||
id: z.number().optional(),
|
||||
nome: z.string().min(1),
|
||||
});
|
||||
|
||||
export const categoriaInputSchema = z.object({
|
||||
id: z.number().optional(),
|
||||
nome: z.string().min(1),
|
||||
});
|
||||
|
||||
export const materialeInputSchema = z.object({
|
||||
id: z.number().optional(),
|
||||
nome: z.string().min(1),
|
||||
proprieta: z.unknown().optional(),
|
||||
});
|
||||
|
||||
export const periodoAnnoInputSchema = z.object({
|
||||
id: z.number().optional(),
|
||||
nome: z.string().min(1),
|
||||
});
|
||||
|
||||
export const attivitaSaveSchema = z.object({
|
||||
id: z.number().optional(),
|
||||
nome: z.string().min(1),
|
||||
stato: tipologicaSchema,
|
||||
brancaList: z.array(brancaInputSchema),
|
||||
categoriaList: z.array(categoriaInputSchema),
|
||||
materialeList: z.array(materialeInputSchema),
|
||||
periodoAnnoList: z.array(periodoAnnoInputSchema),
|
||||
paragrafoList: z.array(paragrafoInputSchema),
|
||||
});
|
||||
|
||||
export type TipologicaInput = z.infer<typeof tipologicaSchema>;
|
||||
export type ParagrafoInput = z.infer<typeof paragrafoInputSchema>;
|
||||
export type BrancaInput = z.infer<typeof brancaInputSchema>;
|
||||
export type CategoriaInput = z.infer<typeof categoriaInputSchema>;
|
||||
export type MaterialeInput = z.infer<typeof materialeInputSchema>;
|
||||
export type PeriodoAnnoInput = z.infer<typeof periodoAnnoInputSchema>;
|
||||
export type AttivitaSaveInput = z.infer<typeof attivitaSaveSchema>;
|
||||
Reference in New Issue
Block a user