-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: removes queue logic from post record and splits it out into pos…
…t-queue (#322) * feat: post queue separated from post record ledger * feat: place most post record logic into post queue * test: adds tests for post queue * test: some fixes, improvements, and tests for post queue
- Loading branch information
Showing
39 changed files
with
781 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
apps/client-server/src/app/database/entities/post-queue-record.entity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Entity, OneToOne, Rel, serialize } from '@mikro-orm/core'; | ||
import { | ||
IPostQueueRecord, | ||
IPostRecord, | ||
ISubmission, | ||
PostQueueRecordDto, | ||
} from '@postybirb/types'; | ||
import { PostRecord } from './post-record.entity'; | ||
import { PostyBirbEntity } from './postybirb-entity'; | ||
import { Submission } from './submission.entity'; | ||
|
||
@Entity() | ||
export class PostQueueRecord | ||
extends PostyBirbEntity | ||
implements IPostQueueRecord | ||
{ | ||
@OneToOne(() => PostRecord, { | ||
nullable: true, | ||
orphanRemoval: false, | ||
serializer: (pr) => pr.id, | ||
eager: true, | ||
inversedBy: 'postQueueRecord', | ||
}) | ||
postRecord?: Rel<IPostRecord>; | ||
|
||
@OneToOne({ | ||
entity: () => Submission, | ||
nullable: false, | ||
serializer: (s) => s.id, | ||
mappedBy: 'postQueueRecord', | ||
orphanRemoval: false, | ||
eager: true, | ||
}) | ||
submission: Rel<ISubmission>; | ||
|
||
toJSON(): PostQueueRecordDto { | ||
return serialize(this) as PostQueueRecordDto; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
apps/client-server/src/app/post/dtos/post-queue-action.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IPostQueueActionDto } from '@postybirb/types'; | ||
import { ArrayNotEmpty, IsArray } from 'class-validator'; | ||
|
||
export class PostQueueActionDto implements IPostQueueActionDto { | ||
@ApiProperty() | ||
@IsArray() | ||
@ArrayNotEmpty() | ||
submissionIds: string[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.