Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat: remove submit

Nevo David80c508a8c255
diff --git a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts
index 620d54c59..b1970d24e 100644
--- a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts
@@ -653,42 +653,6 @@ export class PostsService {
return this._postRepository.countPostsFromDay(orgId, date);
}
- async submit(
- id: string,
- order: string,
- message: string,
- integrationId: string
- ) {
- if (!(await this._messagesService.canAddPost(id, order, integrationId))) {
- throw new Error('You can not add a post to this publication');
- }
- const getOrgByOrder = await this._messagesService.getOrgByOrder(order);
- const submit = await this._postRepository.submit(
- id,
- order,
- getOrgByOrder?.messageGroup?.buyerOrganizationId!
- );
- const messageModel = await this._messagesService.createNewMessage(
- submit?.submittedForOrder?.messageGroupId || '',
- From.SELLER,
- '',
- {
- type: 'post',
- data: {
- id: order,
- postId: id,
- status: 'PENDING',
- integration: integrationId,
- description: message.slice(0, 300) + '...',
- },
- }
- );
-
- await this._postRepository.updateMessage(id, messageModel.id);
-
- return messageModel;
- }
-
async createPost(orgId: string, body: CreatePostDto): Promise<any[]> {
const postList = [];
for (const post of body.posts) {
@@ -723,16 +687,6 @@ export class PostsService {
previousPost ? previousPost : posts?.[0]?.id
);
- if (body.order && body.type !== 'draft') {
- await this.submit(
- posts[0].id,
- body.order,
- post.value[0].content,
- post.integration.id
- );
- continue;
- }
-
if (
body.type === 'now' ||
(body.type === 'schedule' && dayjs(body.date).isAfter(dayjs()))
@@ -770,17 +724,9 @@ export class PostsService {
async changeDate(orgId: string, id: string, date: string) {
const getPostById = await this._postRepository.getPostById(id, orgId);
- if (
- getPostById?.submittedForOrderId &&
- getPostById.approvedSubmitForOrder !== 'NO'
- ) {
- throw new Error(
- 'You can not change the date of a post that has been submitted'
- );
- }
await this._workerServiceProducer.delete('post', id);
- if (getPostById?.state !== 'DRAFT' && !getPostById?.submittedForOrderId) {
+ if (getPostById?.state !== 'DRAFT') {
this._workerServiceProducer.emit('post', {
id: id,
options: {