mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
feat: add external API for publishing posts with image URL and scheduling
- New POST /api/v1/publish endpoint: download image from URL, create post and schedule it per page - New GET /api/v1/pages endpoint: list available pages for external callers - API key auth via X-API-Key header, configurable from admin settings (stored in DB) - New app_config table (migration included) to store the external API key - Admin-only settings section (desktop + mobile) to set/revoke the key - Fallback to EXTERNAL_API_KEY env var if no DB key is configured Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
9e6fe9fe31
commit
391acfdb83
9 files changed
+539
-2
No files matched your search
@@ -215,6 +215,13 @@ export const musicFavorites = pgTable("music_favorites", {
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
});
|
||||
|
||||
export const appConfig = pgTable("app_config", {
|
||||
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
|
||||
externalApiKey: text("external_api_key"),
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
updatedAt: timestamp("updated_at").defaultNow(),
|
||||
});
|
||||
|
||||
export const audioTracks = pgTable("audio_tracks", {
|
||||
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
|
||||
userId: varchar("user_id").references(() => users.id, { onDelete: "cascade" }), // Nullable if uploaded by system/admin globally
|
||||
@@ -477,6 +484,8 @@ export const updateFreesoundConfigSchema = insertFreesoundConfigSchema.omit({
|
||||
});
|
||||
|
||||
export type FreesoundConfig = typeof freesoundConfig.$inferSelect;
|
||||
|
||||
export type AppConfig = typeof appConfig.$inferSelect;
|
||||
export type InsertFreesoundConfig = z.infer<typeof insertFreesoundConfigSchema>;
|
||||
export type UpdateFreesoundConfig = z.infer<typeof updateFreesoundConfigSchema>;
|
||||
|
||||
|
||||
Reference in new issue
Block a user