base con autenticacion, registro, modulo encuestas
This commit is contained in:
59
apps/web/feactures/statistics/schemas/statistics-schema.ts
Normal file
59
apps/web/feactures/statistics/schemas/statistics-schema.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
// Esquema para QuestionStat
|
||||
export const QuestionStatSchema = z.object({
|
||||
questionId: z.string(),
|
||||
label: z.string(),
|
||||
count: z.number(),
|
||||
});
|
||||
|
||||
// Esquema para SurveyDetail
|
||||
export const SurveyDetailSchema = z.object({
|
||||
id: z.number(),
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
totalResponses: z.number(),
|
||||
targetAudience: z.string(),
|
||||
createdAt: z.string(),
|
||||
closingDate: z.string().optional(),
|
||||
questionStats: z.array(QuestionStatSchema),
|
||||
});
|
||||
|
||||
|
||||
// Esquema para SurveyStatisticsData
|
||||
export const SurveyStatisticsDataSchema = z.object({
|
||||
totalSurveys: z.number(),
|
||||
totalResponses: z.number(),
|
||||
completionRate: z.number(),
|
||||
surveysByMonth: z.array(
|
||||
z.object({
|
||||
month: z.string(),
|
||||
count: z.number(),
|
||||
})
|
||||
),
|
||||
responsesByAudience: z.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
value: z.number(),
|
||||
})
|
||||
),
|
||||
responseDistribution: z.array(
|
||||
z.object({
|
||||
title: z.string(),
|
||||
responses: z.number(),
|
||||
})
|
||||
),
|
||||
surveyDetails: z.array(SurveyDetailSchema),
|
||||
// surveyDetails: z.array(z.any()),
|
||||
});
|
||||
|
||||
// Response schemas for the API create, update
|
||||
export const SurveyStatisticsSchema = z.object({
|
||||
message: z.string(),
|
||||
data: SurveyStatisticsDataSchema,
|
||||
});
|
||||
|
||||
// Tipos inferidos de Zod
|
||||
export type SurveyStatisticsType = z.infer<typeof SurveyStatisticsSchema>;
|
||||
export type SurveyDetailType = z.infer<typeof SurveyDetailSchema>;
|
||||
export type QuestionStatType = z.infer<typeof QuestionStatSchema>;
|
||||
35
apps/web/feactures/statistics/schemas/statistics.ts
Normal file
35
apps/web/feactures/statistics/schemas/statistics.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
export interface SurveyStatisticsData {
|
||||
totalSurveys: number;
|
||||
totalResponses: number;
|
||||
completionRate: number;
|
||||
surveysByMonth: {
|
||||
month: string;
|
||||
count: number;
|
||||
}[];
|
||||
responsesByAudience: {
|
||||
name: string;
|
||||
value: number;
|
||||
}[];
|
||||
responseDistribution: {
|
||||
title: string;
|
||||
responses: number;
|
||||
}[];
|
||||
surveyDetails: SurveyDetail[];
|
||||
}
|
||||
|
||||
export interface SurveyDetail {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
totalResponses: number;
|
||||
targetAudience: string;
|
||||
createdAt: string;
|
||||
closingDate?: string;
|
||||
questionStats: QuestionStat[];
|
||||
}
|
||||
|
||||
export interface QuestionStat {
|
||||
questionId: string;
|
||||
label: string;
|
||||
count: number;
|
||||
}
|
||||
Reference in New Issue
Block a user