Add active outreach funnel dashboard
This commit is contained in:
1 parent
deaf86c364
commit
f55ae7ddf8
15 files changed
+519
-1
No files matched your search
@@ -0,0 +1,53 @@
|
||||
import { z } from 'zod';
|
||||
import { RedditAccountOwnerSchema } from './session.js';
|
||||
|
||||
export const OutreachCandidateStatusSchema = z.enum([
|
||||
'discovered',
|
||||
'screening',
|
||||
'ready',
|
||||
'sending',
|
||||
'retryable',
|
||||
]);
|
||||
|
||||
export const OutreachStageCountsSchema = z.strictObject({
|
||||
discovered: z.number().int().nonnegative(),
|
||||
screening: z.number().int().nonnegative(),
|
||||
ready: z.number().int().nonnegative(),
|
||||
sending: z.number().int().nonnegative(),
|
||||
retryable: z.number().int().nonnegative(),
|
||||
});
|
||||
|
||||
export const OutreachCandidateSchema = z.strictObject({
|
||||
postId: z.string(),
|
||||
subreddit: z.string(),
|
||||
author: z.string(),
|
||||
title: z.string(),
|
||||
postUrl: z.string(),
|
||||
sourceType: z.enum(['image', 'chat']),
|
||||
status: OutreachCandidateStatusSchema,
|
||||
priority: z.number(),
|
||||
postCreatedAt: z.number(),
|
||||
discoveredAt: z.number(),
|
||||
updatedAt: z.number(),
|
||||
availableAt: z.number(),
|
||||
attemptCount: z.number().int().nonnegative(),
|
||||
hasPreparedMessage: z.boolean(),
|
||||
note: z.string().nullable(),
|
||||
owner: RedditAccountOwnerSchema.nullable(),
|
||||
});
|
||||
|
||||
export const OutreachFunnelResponseSchema = z.strictObject({
|
||||
generatedAt: z.number(),
|
||||
activeCount: z.number().int().nonnegative(),
|
||||
stages: OutreachStageCountsSchema,
|
||||
outcomes: z.strictObject({
|
||||
sent: z.number().int().nonnegative(),
|
||||
rejected: z.number().int().nonnegative(),
|
||||
}),
|
||||
oldestActiveAt: z.number().nullable(),
|
||||
candidates: z.array(OutreachCandidateSchema),
|
||||
});
|
||||
|
||||
export type OutreachCandidateStatus = z.infer<typeof OutreachCandidateStatusSchema>;
|
||||
export type OutreachCandidate = z.infer<typeof OutreachCandidateSchema>;
|
||||
export type OutreachFunnelResponse = z.infer<typeof OutreachFunnelResponseSchema>;
|
||||
Reference in new issue
Block a user