All files / src/lib/api blogs.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169                                                                                                                                                                                                                                                                                                                                                 
// Blog types - Based on the blog specification
export type BlogStatus =
	| "draft"
	| "pending_approval"
	| "approved"
	| "published"
	| "archived";
 
export type BlogType = "general" | "project_spotlight" | "hybrid";
 
export type IdeaSource = "ai_suggestion" | "pro_request" | "editorial";
 
export type AttributionType =
	| "project_feature"
	| "expert_quote"
	| "roundup"
	| "idea_contributor"
	| "author";
 
export type ApprovalStatus =
	| "pending"
	| "approved"
	| "rewrite_requested"
	| "declined";
 
export type Blog = {
	id: string;
	slug: string;
	title: string;
	metaDescription: string;
	content: string; // HTML
	featuredImageUrl: string | null;
	featuredImageAlt: string | null;
	status: BlogStatus;
	blogType: BlogType;
	primaryKeyword: string | null;
	secondaryKeywords: string[];
	categoryId: string | null;
	cityId: string | null;
	ideaSource: IdeaSource | null;
	ideaSourceProId: string | null;
	ideaSourceProName: string | null;
	readTimeMinutes: number | null;
	publishedAt: number | null;
	dateCreated: number;
	dateUpdated: number;
	createdBy: string;
	tags?: BlogTag[];
};
 
export type BlogPro = {
	id: string;
	blogId: string;
	proId: string;
	attributionType: AttributionType;
	approvalStatus: ApprovalStatus;
	approvalRequestedAt: string;
	approvedAt: string | null;
	declineReason: string | null;
	rewriteCount: number;
};
 
export type BlogProject = {
	id: string;
	blogId: string;
	projectId: string;
	displayOrder: number;
};
 
export type BlogCategory = {
	id: string;
	name: string;
	slug: string;
	description: string | null;
	parentId: string | null;
	displayOrder: number;
};
 
export type BlogTag = {
	id: string;
	name: string;
	slug: string;
};
 
export type ProBlogSuggestion = {
	id: string;
	proId: string;
	topicDescription: string;
	status: "pending" | "accepted" | "rejected" | "published";
	acceptedBlogId: string | null;
	adminNotes: string | null;
	createdAt: string;
	reviewedAt: string | null;
};
 
export type BlogRevision = {
	id: string;
	blogId: string;
	versionNumber: number;
	content: string;
	changeDescription: string;
	createdAt: string;
	createdBy: "platform" | "ai_rewrite";
};
 
// Input types for API calls
export type CreateBlogInput = {
	title: string;
	slug?: string;
	metaDescription?: string;
	content?: string;
	featuredImageUrl?: string;
	featuredImageAlt?: string;
	blogType: BlogType;
	primaryKeyword?: string;
	secondaryKeywords?: string[];
	categoryId?: string;
	cityId?: string;
	ideaSource?: IdeaSource;
	ideaSourceProId?: string;
	tagIds?: string[];
};
 
export type UpdateBlogInput = Partial<CreateBlogInput>;
 
export type AddBlogProInput = {
	proId: string;
	attributionType: AttributionType;
};
 
export type AddBlogProjectInput = {
	projectId: string;
	displayOrder?: number;
};
 
export type BlogListFilters = {
	status?: BlogStatus;
	blogType?: BlogType;
	categoryId?: string;
	cityId?: string;
	ideaSource?: IdeaSource;
	search?: string;
	page?: number;
	limit?: number;
};
 
export type SubmitBlogSuggestionInput = {
	topicDescription: string;
	projectId?: string;
	includeExpertQuote?: boolean;
	includeProjectFeature?: boolean;
};
 
// AI Topic Suggestion Types
export type TopicSuggestion = {
	title: string;
	blog_type: "general" | "project_spotlight" | "hybrid";
	primary_keyword: string;
	secondary_keywords: string[];
	outline: string;
	seo_value: string;
	pro_angle?: string;
};
 
export type AITopicSuggestionsResponse = {
	suggestions: TopicSuggestion[];
	count: number;
};