Add core-setup models #15
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relationships Overview
Actor
The Actor is the core entity (user or agent) that interacts with the system. It:
Activity
The Activity is an action performed by an Actor. It:
Note
The Note represents textual content authored by an Actor. It:
PortabilityOutbox
The PortabilityOutbox serves as an aggregate of an Actor’s portable activities. It:
Relationships in Detail
a. Actor → Activity
actor = models.ForeignKey(Actor, on_delete=models.CASCADE, related_name="activities")b. Actor → Note
attributed_to = models.ForeignKey(Actor, on_delete=models.CASCADE, related_name="notes")c. Activity → Note
d. Actor → PortabilityOutbox
actor = models.ForeignKey(Actor, on_delete=models.CASCADE, related_name="portability_outbox")e. PortabilityOutbox → Activity
activities = models.ManyToManyField(Activity, related_name="outbox_collections")Real-World Example
Use Case: Alice writes a post and likes Bob’s post.
JSON-LD Representation
Outbox JSON-LD
{ "@context": "https://www.w3.org/ns/activitystreams", "type": "OrderedCollection", "id": "https://example.com/users/alice/outbox", "totalItems": 2, "items": [ { "@context": "https://www.w3.org/ns/activitystreams", "type": "Create", "id": "https://example.com/activities/1", "actor": "https://example.com/users/alice", "published": "2024-11-08T12:00:00Z", "visibility": "public", "object": { "@context": "https://www.w3.org/ns/activitystreams", "type": "Note", "id": "https://example.com/notes/1", "attributedTo": "https://example.com/users/alice", "content": "Hello, world!", "published": "2024-11-08T12:00:00Z", "visibility": "public" } }, { "@context": "https://www.w3.org/ns/activitystreams", "type": "Like", "id": "https://example.com/activities/2", "actor": "https://example.com/users/alice", "published": "2024-11-08T12:01:00Z", "visibility": "public", "content": "Liked Bob's post." } ] }