ManyToManyInfo
Information for resources that represent many-to-many relationships. Used as part of ResourceMeta to define connection information between two entities. Many-to-many relationships can be implemented either as direct relationships between resources Resource + Resource, for example StudentCourse, or through connector resources Resource + Connector + Resource, for example StudentToCourse.
Example
// Example of a many-to-many resource declaration
export class StudentCourse implements WithWorkspaceId {
id!: string;
studentId!: string; // manyToManyFirstPropertyName
courseId!: string; // manyToManySecondPropertyName
student?: Student; // firstExpandPropertyName
course?: Course; // secondExpandPropertyName
}
Properties
firstExpandPropertyName
firstExpandPropertyName:
string
The property name in the many-to-many resource where the expanded first resource object will be placed when using expand/select operations.
firstResourceName
firstResourceName:
string
The name of the first related resource.
isMirrorManyToManyResource
isMirrorManyToManyResource:
boolean
Indicates whether this resource is a symmetrical many-to-many relationship where both connected resources are of the same type (e.g., StudentToStudent). When true, it means the same resource type appears on both sides of the relationship.
manyToManyFirstPropertyName
manyToManyFirstPropertyName:
string
The property name in the many-to-many resource that contains the id of the first resource. This is the property name where the first resource's id will be stored.
manyToManyResourceName
manyToManyResourceName:
string
The name of the many-to-many resource that connects the two entities.
manyToManySecondPropertyName
manyToManySecondPropertyName:
string
The property name in the many-to-many resource that contains the id of the second resource. This is the property name where the second resource's id will be stored.
secondExpandPropertyName
secondExpandPropertyName:
string
The property name in the many-to-many resource where the expanded second resource object will be placed when using expand/select operations.
secondResourceName
secondResourceName:
string
The name of the second related resource.