107 lines
2.4 KiB
TypeScript
107 lines
2.4 KiB
TypeScript
export type CampaignStatus = 'deposit' | 'voting' | 'closed';
|
|
|
|
export interface Campaign {
|
|
id: string;
|
|
title: string;
|
|
description: string; // Support markdown
|
|
status: CampaignStatus;
|
|
budget_per_user: number;
|
|
spending_tiers: string; // Montants séparés par des virgules
|
|
slug?: string; // Slug unique pour les liens courts
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
export interface CampaignWithStats extends Campaign {
|
|
stats: {
|
|
propositions: number;
|
|
participants: number;
|
|
};
|
|
}
|
|
|
|
export interface Proposition {
|
|
id: string;
|
|
campaign_id: string;
|
|
title: string;
|
|
description: string; // Support markdown
|
|
author_first_name: string;
|
|
author_last_name: string;
|
|
author_email: string;
|
|
created_at: string;
|
|
}
|
|
|
|
export interface Participant {
|
|
id: string;
|
|
campaign_id: string;
|
|
first_name: string;
|
|
last_name: string;
|
|
email: string;
|
|
short_id?: string; // Identifiant court unique pour les liens de vote
|
|
created_at: string;
|
|
}
|
|
|
|
export interface Vote {
|
|
id: string;
|
|
participant_id: string;
|
|
proposition_id: string;
|
|
amount: number;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
export interface PropositionWithVote extends Proposition {
|
|
vote?: Vote;
|
|
}
|
|
|
|
export interface ParticipantWithVoteStatus extends Participant {
|
|
has_voted: boolean;
|
|
total_voted_amount?: number;
|
|
}
|
|
|
|
export interface Setting {
|
|
id: string;
|
|
key: string;
|
|
value: string;
|
|
category: string;
|
|
description?: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
export interface SmtpSettings {
|
|
host: string;
|
|
port: number;
|
|
username: string;
|
|
password: string;
|
|
secure: boolean;
|
|
from_email: string;
|
|
from_name: string;
|
|
}
|
|
|
|
export interface Database {
|
|
public: {
|
|
Tables: {
|
|
campaigns: {
|
|
Row: Campaign;
|
|
Insert: Omit<Campaign, 'id' | 'created_at' | 'updated_at'>;
|
|
Update: Partial<Omit<Campaign, 'id' | 'created_at' | 'updated_at'>>;
|
|
};
|
|
propositions: {
|
|
Row: Proposition;
|
|
Insert: Omit<Proposition, 'id' | 'created_at'>;
|
|
Update: Partial<Omit<Proposition, 'id' | 'created_at'>>;
|
|
};
|
|
participants: {
|
|
Row: Participant;
|
|
Insert: Omit<Participant, 'id' | 'created_at'>;
|
|
Update: Partial<Omit<Participant, 'id' | 'created_at'>>;
|
|
};
|
|
settings: {
|
|
Row: Setting;
|
|
Insert: Omit<Setting, 'id' | 'created_at' | 'updated_at'>;
|
|
Update: Partial<Omit<Setting, 'id' | 'created_at' | 'updated_at'>>;
|
|
};
|
|
};
|
|
};
|
|
}
|