mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 09:14:08 +00:00
Create the complete TypeScript foundation for the Vue 3 migration in a parallel scripts-v2/ directory. 72 files, 5430 lines, zero any types, strict mode. - types/ (21 files): Domain interfaces for all 17 entities derived from actual Laravel models and API resources. Enums for all statuses. Generic API response wrappers. - api/ (29 files): Typed axios client with interceptors, endpoint constants from routes/api.php, 25 typed service classes covering every API endpoint. - composables/ (14 files): Vue 3 composition functions for auth, notifications, dialogs, modals, pagination, filters, currency, dates, theme, sidebar, company context, and permissions. - utils/ (5 files): Pure typed utilities for money formatting, date formatting (date-fns), localStorage, and error handling. - config/ (3 files): Typed ability constants, app constants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
72 lines
1.6 KiB
TypeScript
72 lines
1.6 KiB
TypeScript
import { client } from '../client'
|
|
import { API } from '../endpoints'
|
|
|
|
export interface MailDriver {
|
|
name: string
|
|
value: string
|
|
}
|
|
|
|
export interface SmtpConfig {
|
|
mail_driver: string
|
|
mail_host: string
|
|
mail_port: number | null
|
|
mail_username: string
|
|
mail_password: string
|
|
mail_encryption: string
|
|
from_mail: string
|
|
from_name: string
|
|
}
|
|
|
|
export interface MailgunConfig {
|
|
mail_driver: string
|
|
mail_mailgun_domain: string
|
|
mail_mailgun_secret: string
|
|
mail_mailgun_endpoint: string
|
|
from_mail: string
|
|
from_name: string
|
|
}
|
|
|
|
export interface SesConfig {
|
|
mail_driver: string
|
|
mail_host: string
|
|
mail_port: number | null
|
|
mail_ses_key: string
|
|
mail_ses_secret: string
|
|
mail_ses_region: string
|
|
from_mail: string
|
|
from_name: string
|
|
}
|
|
|
|
export type MailConfig = SmtpConfig | MailgunConfig | SesConfig
|
|
|
|
export interface MailConfigResponse {
|
|
mail_driver: string
|
|
[key: string]: unknown
|
|
}
|
|
|
|
export interface TestMailPayload {
|
|
to: string
|
|
}
|
|
|
|
export const mailService = {
|
|
async getDrivers(): Promise<MailDriver[]> {
|
|
const { data } = await client.get(API.MAIL_DRIVERS)
|
|
return data
|
|
},
|
|
|
|
async getConfig(): Promise<MailConfigResponse> {
|
|
const { data } = await client.get(API.MAIL_CONFIG)
|
|
return data
|
|
},
|
|
|
|
async saveConfig(payload: MailConfig): Promise<{ success?: string; error?: string }> {
|
|
const { data } = await client.post(API.MAIL_CONFIG, payload)
|
|
return data
|
|
},
|
|
|
|
async testEmail(payload: TestMailPayload): Promise<{ success?: boolean; error?: string }> {
|
|
const { data } = await client.post(API.MAIL_TEST, payload)
|
|
return data
|
|
},
|
|
}
|