mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
Add token expiration date to social media pages for managed accounts
Update schema and routes to include a `tokenExpiresAt` field, setting it to 60 days after creation for social media page tokens. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: a818a1ee-3b1a-48f9-9639-24fc156db095 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/5aomXd9
This commit is contained in:
1 parent
0d5505edbf
commit
c47722134b
2 files changed
+11
-1
No files matched your search
+10
-1
@@ -1155,7 +1155,16 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
try {
|
try {
|
||||||
const user = req.user as User;
|
const user = req.user as User;
|
||||||
const userId = user.id;
|
const userId = user.id;
|
||||||
const pageData = insertSocialPageSchema.parse({ ...req.body, userId });
|
|
||||||
|
// Calculate token expiration date (60 days from now)
|
||||||
|
const tokenExpiresAt = new Date();
|
||||||
|
tokenExpiresAt.setDate(tokenExpiresAt.getDate() + 60);
|
||||||
|
|
||||||
|
const pageData = insertSocialPageSchema.parse({
|
||||||
|
...req.body,
|
||||||
|
userId,
|
||||||
|
tokenExpiresAt
|
||||||
|
});
|
||||||
const page = await storage.createSocialPage(pageData);
|
const page = await storage.createSocialPage(pageData);
|
||||||
res.json(page);
|
res.json(page);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export const socialPages = pgTable("social_pages", {
|
|||||||
pageId: text("page_id").notNull(),
|
pageId: text("page_id").notNull(),
|
||||||
pageName: text("page_name").notNull(),
|
pageName: text("page_name").notNull(),
|
||||||
accessToken: text("access_token").notNull(),
|
accessToken: text("access_token").notNull(),
|
||||||
|
tokenExpiresAt: timestamp("token_expires_at"),
|
||||||
followersCount: integer("followers_count").default(0),
|
followersCount: integer("followers_count").default(0),
|
||||||
isActive: text("is_active").notNull().default("true"),
|
isActive: text("is_active").notNull().default("true"),
|
||||||
createdAt: timestamp("created_at").defaultNow(),
|
createdAt: timestamp("created_at").defaultNow(),
|
||||||
|
|||||||
Reference in new issue
Block a user