feat: expand backend admin marketplace and scaling
فشلت بعض الفحوصات
/ deploy (push) Failing after 1m22s

هذا الالتزام موجود في:
2026-05-14 16:17:12 +03:00
الأصل 0e76a4a9fc
التزام 5bd5e19a89
158 ملفات معدلة مع 19563 إضافات و3315 حذوفات

عرض الملف

@@ -1,7 +1,12 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { HydratedDocument, Types } from 'mongoose';
import { ModerationStatus } from '../../../common/enums/moderation-status.enum';
import { PostType } from '../../../common/enums/post-type.enum';
import { PostVisibility } from '../../../common/enums/post-visibility.enum';
import {
resolveManagedFileUrl,
resolveManagedFileUrls,
} from '../../../common/utils/public-url.util';
import { User } from '../../users/schemas/user.schema';
export type PostDocument = HydratedDocument<Post>;
@@ -20,6 +25,42 @@ export class Post {
@Prop({ default: '' })
audioUrl!: string;
@Prop({ type: Number, min: 1, max: 7200, default: null })
durationSeconds!: number | null;
@Prop({ default: '' })
thumbnailUrl!: string;
@Prop({ default: '', trim: true, maxlength: 80 })
style!: string;
@Prop({ default: '', trim: true, maxlength: 80 })
maqam!: string;
@Prop({ default: '', trim: true, maxlength: 40 })
rhythmSignature!: string;
@Prop({ type: [Number], default: [] })
waveformPeaks!: number[];
@Prop({ type: [String], default: [] })
imageUrls!: string[];
@Prop({ type: [Types.ObjectId], ref: User.name, default: [], index: true })
taggedUserIds!: Types.ObjectId[];
@Prop({ type: [String], default: [] })
mentionUsernames!: string[];
@Prop({ default: '' })
location!: string;
@Prop({ type: Number, min: -90, max: 90, default: null })
latitude!: number | null;
@Prop({ type: Number, min: -180, max: 180, default: null })
longitude!: number | null;
@Prop({ enum: PostType, default: PostType.TEXT, index: true })
postType!: PostType;
@@ -35,9 +76,29 @@ export class Post {
@Prop({ default: 0, min: 0 })
savesCount!: number;
@Prop({ default: 0, min: 0 })
shareCount!: number;
@Prop({ default: 0, min: 0 })
viewCount!: number;
@Prop({ default: 0, min: 0 })
playCount!: number;
@Prop({ type: [String], default: [], index: true })
hashtags!: string[];
@Prop({
type: String,
enum: Object.values(ModerationStatus),
default: ModerationStatus.ACTIVE,
index: true,
})
moderationStatus!: ModerationStatus;
@Prop({ default: '', maxlength: 300 })
moderationReason!: string;
@Prop({ default: false, index: true })
isDeleted!: boolean;
@@ -54,6 +115,29 @@ PostSchema.index({ authorId: 1, createdAt: -1 });
PostSchema.index({ visibility: 1, createdAt: -1 });
PostSchema.index({ postType: 1, createdAt: -1 });
PostSchema.index({ hashtags: 1, createdAt: -1 });
PostSchema.index({ taggedUserIds: 1, createdAt: -1 });
PostSchema.index({ moderationStatus: 1, createdAt: -1 });
PostSchema.index({ authorId: 1, isDeleted: 1, createdAt: -1 });
PostSchema.index({ visibility: 1, isDeleted: 1, createdAt: -1 });
PostSchema.index({ visibility: 1, isDeleted: 1, likesCount: -1, commentsCount: -1, savesCount: -1, createdAt: -1 });
PostSchema.index({
visibility: 1,
isDeleted: 1,
likesCount: -1,
commentsCount: -1,
savesCount: -1,
shareCount: -1,
viewCount: -1,
playCount: -1,
createdAt: -1,
});
const transformManagedPostFiles = (_doc: unknown, ret: any) => {
ret.imageUrls = resolveManagedFileUrls(ret.imageUrls);
ret.videoUrl = resolveManagedFileUrl(ret.videoUrl);
ret.audioUrl = resolveManagedFileUrl(ret.audioUrl);
ret.thumbnailUrl = resolveManagedFileUrl(ret.thumbnailUrl);
return ret;
};
PostSchema.set('toJSON', { transform: transformManagedPostFiles });
PostSchema.set('toObject', { transform: transformManagedPostFiles });