π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: scheduling edge-cases
Nevo Daviddefd9e0a63ce
diff --git a/apps/frontend/src/components/launches/calendar.tsx b/apps/frontend/src/components/launches/calendar.tsxindex c21438219..3d08ddd7b 100644--- a/apps/frontend/src/components/launches/calendar.tsx+++ b/apps/frontend/src/components/launches/calendar.tsx@@ -525,7 +525,7 @@ export const CalendarColumn: FC<{modal.openModal({title: t('select_set', 'Select a Set'),closeOnClickOutside: true,- askClose: true,+ askClose: false,closeOnEscape: true,withCloseButton: true,onClose: () => resolve('exit'),diff --git a/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts b/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.tsindex 5b735cdf3..04490afc1 100644--- a/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts+++ b/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts@@ -330,13 +330,14 @@ export class PostsRepository {return update;}- async changeDate(orgId: string, id: string, date: string) {+ async changeDate(orgId: string, id: string, date: string, isDraft: boolean) {return this._post.model.post.update({where: {organizationId: orgId,id,},data: {+ state: isDraft ? 'DRAFT' : 'QUEUE',publishDate: dayjs(date).toDate(),},});diff --git a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.tsindex 7d2deb100..5ed3feb49 100644--- a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts+++ b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts@@ -541,7 +541,12 @@ export class PostsService {return this._postRepository.getPostByForWebhookId(id);}- async startWorkflow(taskQueue: string, postId: string, orgId: string) {+ async startWorkflow(+ taskQueue: string,+ postId: string,+ orgId: string,+ state: State+ ) {try {const workflows = this._temporalService.client.getRawClient()@@ -564,6 +569,10 @@ export class PostsService {}} catch (err) {}+ if (state === 'DRAFT') {+ return;+ }+try {await this._temporalService.client.getRawClient()@@ -621,7 +630,8 @@ export class PostsService {this.startWorkflow(post.settings.__type.split('-')[0].toLowerCase(),posts[0].id,- orgId+ orgId,+ posts[0].state).catch((err) => {});Sentry.metrics.count('post_created', 1);@@ -644,13 +654,19 @@ export class PostsService {async changeDate(orgId: string, id: string, date: string) {const getPostById = await this._postRepository.getPostById(id, orgId);- const newDate = await this._postRepository.changeDate(orgId, id, date);+ const newDate = await this._postRepository.changeDate(+ orgId,+ id,+ date,+ getPostById.state === 'DRAFT'+ );try {await this.startWorkflow(getPostById.integration.providerIdentifier.split('-')[0].toLowerCase(),getPostById.id,- orgId+ orgId,+ getPostById.state);} catch (err) {}