Skip to content

Commit c466af7

Browse files
committed
Add publication date and additional fields to new post action integrations
1 parent 175e02e commit c466af7

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

apps/web/pages/api/integrations/github/action-new-post.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { IErrorResponse } from "@changes-page/supabase/types/api";
2+
import { IPost, PostStatus } from "@changes-page/supabase/types/page";
13
import type { NextApiRequest, NextApiResponse } from "next";
24
import { v4 } from "uuid";
3-
import { IErrorResponse } from "@changes-page/supabase/types/api";
4-
import { IPost } from "@changes-page/supabase/types/page";
55
import {
66
createPost,
77
getPageByIntegrationSecret,
@@ -37,6 +37,11 @@ export default async function handler(
3737
type,
3838
status,
3939
images_folder: v4(),
40+
publication_date:
41+
status === PostStatus.published ? new Date().toISOString() : null,
42+
notes: "",
43+
allow_reactions: false,
44+
email_notified: false,
4045
});
4146

4247
res.status(200).json({

apps/web/pages/api/integrations/zapier/action-new-post.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { IErrorResponse } from "@changes-page/supabase/types/api";
2-
import { IPost } from "@changes-page/supabase/types/page";
2+
import { IPost, PostStatus } from "@changes-page/supabase/types/page";
33
import type { NextApiRequest, NextApiResponse } from "next";
44
import { v4 } from "uuid";
55
import {
@@ -41,6 +41,11 @@ export default async function handler(
4141
tags,
4242
status,
4343
images_folder: v4(),
44+
publication_date:
45+
status === PostStatus.published ? new Date().toISOString() : null,
46+
notes: "",
47+
allow_reactions: false,
48+
email_notified: false,
4449
});
4550

4651
res.status(200).json(data);

0 commit comments

Comments
 (0)