add prettifier

This commit is contained in:
philipredstone
2025-04-15 14:46:06 +02:00
parent c078610c4d
commit eceacf2117
43 changed files with 10946 additions and 6173 deletions

View File

@ -1,48 +1,45 @@
import mongoose, { Document, Schema } from 'mongoose';
export interface IRelationship extends Document {
_id: string;
source: mongoose.Types.ObjectId;
target: mongoose.Types.ObjectId;
type: string;
customType?: string;
network: mongoose.Types.ObjectId;
}
const RelationshipSchema = new Schema(
{
source: {
type: Schema.Types.ObjectId,
ref: 'Person',
required: true,
},
target: {
type: Schema.Types.ObjectId,
ref: 'Person',
required: true,
},
type: {
type: String,
required: [true, 'Relationship type is required'],
enum: ['freund', 'partner', 'familie', 'arbeitskolleg', 'custom'],
},
customType: {
type: String,
trim: true,
},
network: {
type: Schema.Types.ObjectId,
ref: 'Network',
required: true,
},
},
{ timestamps: true }
);
// Create compound index to ensure unique relationships in a network
RelationshipSchema.index(
{ source: 1, target: 1, network: 1 },
{ unique: true }
);
export default mongoose.model<IRelationship>('Relationship', RelationshipSchema);
import mongoose, { Document, Schema } from 'mongoose';
export interface IRelationship extends Document {
_id: string;
source: mongoose.Types.ObjectId;
target: mongoose.Types.ObjectId;
type: string;
customType?: string;
network: mongoose.Types.ObjectId;
}
const RelationshipSchema = new Schema(
{
source: {
type: Schema.Types.ObjectId,
ref: 'Person',
required: true,
},
target: {
type: Schema.Types.ObjectId,
ref: 'Person',
required: true,
},
type: {
type: String,
required: [true, 'Relationship type is required'],
enum: ['freund', 'partner', 'familie', 'arbeitskolleg', 'custom'],
},
customType: {
type: String,
trim: true,
},
network: {
type: Schema.Types.ObjectId,
ref: 'Network',
required: true,
},
},
{ timestamps: true }
);
// Create compound index to ensure unique relationships in a network
RelationshipSchema.index({ source: 1, target: 1, network: 1 }, { unique: true });
export default mongoose.model<IRelationship>('Relationship', RelationshipSchema);