refactor upcycle

This commit is contained in:
Mayel de Borniol 2022-02-12 19:26:34 +13:00
parent be37614307
commit f4a577c03f
7 changed files with 357 additions and 254 deletions

1
.gitignore vendored
View file

@ -91,4 +91,5 @@ flavours/*/classic
flavours/*/cooperation
flavours/*/haha
flavours/*/reflow
flavours/*/upcycle
.DS_Store

View file

@ -35,7 +35,7 @@ context_and_queries_extensions = pointable_schema_extensions ++ [
:bonfire_social,
:bonfire_valueflows
]
config :bonfire, :query_modules_search_path, context_and_queries_extensions
config :bonfire, :query_modules_search_path, context_and_queries_extensions
config :bonfire, :context_modules_search_path, context_and_queries_extensions
# Search these apps/extensions for Verbs to index (i.e. they contain modules with a declare_verbs/0 function)
@ -50,15 +50,22 @@ config :bonfire_data_access_control,
#### Alias modules for readability
alias Pointers.{Pointer, Table}
alias Bonfire.Data.AccessControl.{
Access, Acl, Controlled, InstanceAdmin, Grant, Interact, Verb
Acl, Circle, Encircle, Controlled, InstanceAdmin, Grant, Verb,
}
alias Bonfire.Data.ActivityPub.{Actor, Peer, Peered}
alias Bonfire.Boundaries.Stereotype
alias Bonfire.Data.Edges.{Edge,EdgeTotal}
alias Bonfire.Data.Identity.{
Account, Accounted, Caretaker, Character, Credential, Email, Self, User, Named
Account, Accounted, Caretaker, Character, Credential, Email, Named, Self, User,
}
alias Bonfire.Data.Social.{
Activity, Article, Block, Bookmark, Circle, Created, Encircle, Feed, FeedPublish, Inbox, Message, Follow, FollowCount, Boost, BoostCount, Like, LikeCount, Flag, FlagCount, Mention, Post, PostContent, Profile, Replied
Activity, Article, Block, Bookmark, Created, Feed, FeedPublish, Message, Follow,
Boost, Like, Flag, Mention, Post, PostContent, Profile, Replied,
}
alias Bonfire.Classify.Category
alias Bonfire.Geolocate.Geolocation
alias Bonfire.Files.Media
alias Bonfire.{Tag, Tag.Tagged}
#### Flexto Stitching
@ -71,34 +78,62 @@ alias Bonfire.Data.Social.{
## Note: This does not apply to configuration for
## `Pointers.Changesets`, which is read at runtime, not compile time
edge = quote do
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
has_many :activities, unquote(Activity), foreign_key: :object_id, references: :id
end
edges = quote do
unquote(edge)
# has_one :edge, unquote(Edge), foreign_key: :id
has_one :activity, unquote(Activity), foreign_key: :object_id, references: :id # requires an ON clause
end
# first up, pointers could have all the mixins we're using. TODO
config :pointers, Pointer,
has_one: [controlled: {Controlled, foreign_key: :id}],
has_one: [created: {Created, foreign_key: :id}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
has_one: [activity: {Activity, foreign_key: :object_id, references: :id}], # needs ON clause
has_one: [post_content: {PostContent, foreign_key: :id}],
has_one: [like_count: {LikeCount, foreign_key: :id}],
has_many: [likes: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_like: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_flag: {Flag, foreign_key: :flagged_id, references: :id}],
has_one: [replied: {Replied, foreign_key: :id}],
has_many: [direct_replies: {Replied, foreign_key: :reply_to_id}],
has_one: [profile: {Profile, foreign_key: :id}],
has_one: [character: {Character, foreign_key: :id}],
has_one: [actor: {Actor, foreign_key: :id}],
# add references of tags to any tagged Pointer
many_to_many: [
tags: {
Bonfire.Tag,
join_through: "bonfire_tagged",
[code: quote do
@like_ulid "11KES11KET0BE11KEDY0VKN0WS"
@boost_ulid "300STANN0VNCERESHARESH0VTS"
@follow_ulid "70110WTHE1EADER1EADER1EADE"
# pointables
has_one :circle, unquote(Circle), foreign_key: :id
has_one :user, unquote(User), foreign_key: :id
has_one :post, unquote(Post), foreign_key: :id
has_one :message, unquote(Message), foreign_key: :id
has_one :category, unquote(Category), references: :id, foreign_key: :id
has_one :geolocation, unquote(Geolocation), references: :id, foreign_key: :id
# mixins
has_one :stereotype, unquote(Stereotype), foreign_key: :id
has_one :named, unquote(Named), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
has_one :created, unquote(Created), foreign_key: :id
has_one :peered, unquote(Peered), foreign_key: :id, references: :id
has_one :activity, unquote(Activity), foreign_key: :object_id, references: :id
has_one :post_content, unquote(PostContent), foreign_key: :id
has_one :replied, unquote(Replied), foreign_key: :id
has_one :profile, unquote(Profile), foreign_key: :id
has_one :character, unquote(Character), foreign_key: :id
has_one :actor, unquote(Actor), foreign_key: :id
has_one :edge, unquote(Edge), foreign_key: :id
has_one :like_count, unquote(EdgeTotal),
foreign_key: :id, references: :id, where: [table_id: @like_ulid]
has_one :boost_count, unquote(EdgeTotal),
foreign_key: :id, references: :id, where: [table_id: @boost_ulid]
has_one :follow_count, unquote(EdgeTotal),
foreign_key: :id, references: :id, where: [table_id: @follow_ulid]
has_many :direct_replies, unquote(Replied), foreign_key: :reply_to_id
# add references of tags to any tagged Pointer
has_many :tagged, unquote(Tagged), foreign_key: :id, references: :id
many_to_many :tags, unquote(Pointer),
join_through: unquote(Tagged),
unique: true,
join_keys: [pointer_id: :id, tag_id: :id],
join_keys: [id: :id, tag_id: :id],
on_replace: :delete
}
]
end]
config :pointers, Table, []
@ -106,30 +141,42 @@ config :pointers, Table, []
# bonfire_data_access_control
config :bonfire_data_access_control, Access,
has_one: [named: {Named, foreign_key: :id}],
has_one: [caretaker: {Caretaker, foreign_key: :id}]
config :bonfire_data_access_control, Acl,
has_one: [named: {Named, foreign_key: :id}],
has_one: [caretaker: {Caretaker, foreign_key: :id}]
[code: quote do
# this allows us to identify acls for the user which have special
# meaning to the system, such as "public" or "private"
has_one :stereotype, unquote(Stereotype), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
has_one :named, unquote(Named), foreign_key: :id
# has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
end]
config :bonfire_data_access_control, Circle,
[code: quote do
has_one :caretaker, unquote(Caretaker), foreign_key: :id
has_one :named, unquote(Named), foreign_key: :id
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
end]
config :bonfire_data_access_control, Controlled, []
config :bonfire_data_access_control, Encircle, []
config :bonfire_data_access_control, Grant,
belongs_to: [subject_character: {Character, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_profile: {Profile, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_circle: {Circle, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_named: {Named, foreign_key: :subject_id, define_field: false}]
[code: quote do
has_one :caretaker, unquote(Caretaker), foreign_key: :id
# has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
end]
config :bonfire_data_access_control, Interact, []
config :bonfire_data_access_control, Verb, []
# bonfire_data_activity_pub
config :bonfire_data_activity_pub, Actor,
belongs_to: [character: {Character, foreign_key: :id, define_field: false}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
belongs_to: [user: {User, foreign_key: :id, define_field: false}]
[code: quote do
belongs_to :character, unquote(Character), foreign_key: :id, define_field: false
belongs_to :user, unquote(User), foreign_key: :id, define_field: false
has_one :peered, unquote(Peered), foreign_key: :id, references: :id
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
end]
config :bonfire_data_activity_pub, Peer, []
config :bonfire_data_activity_pub, Peered, []
@ -137,262 +184,310 @@ config :bonfire_data_activity_pub, Peered, []
# bonfire_data_identity
config :bonfire_data_identity, Account,
has_one: [credential: {Credential, foreign_key: :id}],
has_one: [email: {Email, foreign_key: :id}],
has_one: [inbox: {Inbox, foreign_key: :id}],
many_to_many: [users: {User, join_through: "bonfire_data_identity_accounted", join_keys: [account_id: :id, id: :id]}],
many_to_many: [shared_users: {User, join_through: "bonfire_data_shared_user_accounts", join_keys: [account_id: :id, shared_user_id: :id]}]
[code: quote do
has_one :credential, unquote(Credential),foreign_key: :id
has_one :email, unquote(Email), foreign_key: :id
many_to_many :users, unquote(User),
join_through: "bonfire_data_identity_accounted",
join_keys: [account_id: :id, id: :id]
many_to_many :shared_users, unquote(User),
join_through: "bonfire_data_shared_user_accounts",
join_keys: [account_id: :id, shared_user_id: :id]
end]
config :bonfire_data_identity, Accounted,
belongs_to: [user: {User, foreign_key: :id, define_field: false}]
[code: quote do
belongs_to :user, unquote(User), foreign_key: :id, define_field: false
end]
config :bonfire_data_identity, Caretaker, []
config :bonfire_data_identity, Character,
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
has_one: [actor: {Actor, foreign_key: :id}],
has_one: [profile: {Profile, foreign_key: :id}],
has_one: [user: {User, foreign_key: :id}],
has_one: [feed: {Feed, foreign_key: :id}],
has_one: [inbox: {Inbox, foreign_key: :id}],
has_many: [feed_publishes: {FeedPublish, references: :id, foreign_key: :feed_id}],
has_many: [followers: {Follow, foreign_key: :following_id, references: :id}],
has_many: [followed: {Follow, foreign_key: :follower_id, references: :id}],
has_one: [follow_count: {FollowCount, foreign_key: :id}]
[code: quote do
@follow_ulid "70110WTHE1EADER1EADER1EADE"
has_one :peered, unquote(Peered), references: :id, foreign_key: :id
has_one :actor, unquote(Actor), foreign_key: :id
has_one :profile, unquote(Profile), foreign_key: :id
has_one :user, unquote(User), foreign_key: :id
has_one :feed, unquote(Feed), foreign_key: :id
has_many :followers, unquote(Follow), foreign_key: :following_id, references: :id
has_many :followed, unquote(Follow), foreign_key: :follower_id, references: :id
has_one :follow_count, unquote(EdgeTotal),
foreign_key: :id, references: :id, where: [table_id: @follow_ulid]
end]
config :bonfire_data_identity, Credential,
belongs_to: [account: {Account, foreign_key: :id, define_field: false}]
[code: quote do
belongs_to :account, unquote(Account), foreign_key: :id, define_field: false
end]
config :bonfire_data_identity, Email,
must_confirm: true,
belongs_to: [account: {Account, foreign_key: :id, define_field: false}]
[must_confirm: true,
code: quote do
belongs_to :account, unquote(Account), foreign_key: :id, define_field: false
end]
config :bonfire_data_identity, Self, []
config :bonfire_data_identity, User,
has_one: [accounted: {Accounted, foreign_key: :id}],
# has_many: [account: {[through: [:accounted, :account]]}], # this is private info, do not expose
has_one: [profile: {Profile, foreign_key: :id}],
has_one: [character: {Character, foreign_key: :id}],
has_one: [actor: {Actor, foreign_key: :id}],
has_one: [instance_admin: {InstanceAdmin, foreign_key: :id}],
has_one: [self: {Self, foreign_key: :id}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
has_many: [encircles: {Encircle, foreign_key: :subject_id}],
has_one: [shared_user: {Bonfire.Data.SharedUser, foreign_key: :id}],
many_to_many: [caretaker_accounts: {Account, join_through: "bonfire_data_shared_user_accounts", join_keys: [shared_user_id: :id, account_id: :id]}],
# has_one: [geolocation: {Bonfire.Geolocate.Geolocation}]
has_many: [created: {Created, foreign_key: :creator_id}],
has_many: [creations: {[through: [:created, :pointer]]}],
has_many: [posts: {[through: [:created, :post]]}],
has_many: [user_activities: {Activity, foreign_key: :subject_id, references: :id}],
has_many: [user_feed: Activity], # requires custom filtering
has_many: [user_notifications: Activity], # requires custom filtering
has_many: [boosted: {Boost, foreign_key: :booster_id, references: :id}],
has_many: [boost_activities: {[through: [:boosted, :activity]]}],
has_many: [liked: {Like, foreign_key: :liker_id, references: :id}],
has_many: [like_activities: {[through: [:liked, :activity]]}],
has_many: [followers: {Follow, foreign_key: :followed_id, references: :id}],
has_many: [followed: {Follow, foreign_key: :follower_id, references: :id}]
[code: quote do
has_one :accounted, unquote(Accounted), foreign_key: :id
has_one :profile, unquote(Profile), foreign_key: :id
has_one :character, unquote(Character), foreign_key: :id
has_one :actor, unquote(Actor), foreign_key: :id
has_one :instance_admin, unquote(InstanceAdmin), foreign_key: :id, on_replace: :update
has_one :self, unquote(Self), foreign_key: :id
has_one :peered, unquote(Peered), references: :id, foreign_key: :id
has_many :encircles, unquote(Encircle), foreign_key: :subject_id
has_one :shared_user, unquote(Bonfire.Data.SharedUser), foreign_key: :id
has_many :created, unquote(Created), foreign_key: :creator_id
has_many :creations, through: [:created, :pointer] # todo: stop through
has_many :posts, through: [:created, :post] # todo: stop through
has_many :user_activities, unquote(Activity), foreign_key: :subject_id, references: :id
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
many_to_many :caretaker_accounts, unquote(Account),
join_through: "bonfire_data_shared_user_accounts",
join_keys: [shared_user_id: :id, account_id: :id]
# has_many :account, through: [:accounted, :account] # this is private info, do not expose
# has_one :geolocation, Bonfire.Geolocate.Geolocation
end]
# bonfire_data_social
### bonfire_data_social
config :bonfire_data_social, Activity,
belongs_to: [subject_user: {User, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_character: {Character, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_profile: {Profile, foreign_key: :subject_id, define_field: false}],
belongs_to: [object_peered: {Peered, foreign_key: :object_id, define_field: false}],
belongs_to: [object_post: {Post, foreign_key: :object_id, define_field: false}],
# belongs_to: [object_post_content: {PostContent, foreign_key: :object_id, define_field: false}],
belongs_to: [object_message: {Message, foreign_key: :object_id, define_field: false}],
has_one: [boost_count: {BoostCount, foreign_key: :id, references: :object_id}],
has_one: [like_count: {LikeCount, foreign_key: :id, references: :object_id}],
has_many: [boosts: {Boost, foreign_key: :boosted_id, references: :object_id}],
has_many: [likes: {Like, foreign_key: :liked_id, references: :object_id}],
has_one: [my_like: {Like, foreign_key: :liked_id, references: :object_id}],
has_one: [my_boost: {Boost, foreign_key: :boosted_id, references: :object_id}],
has_one: [my_flag: {Flag, foreign_key: :flagged_id, references: :object_id}],
has_one: [replied: {Replied, foreign_key: :id, references: :object_id}],
# has_one: [reply_to: {[through: [:replied, :reply_to]]}],
# has_one: [reply_to_post: {[through: [:replied, :reply_to_post]]}],
# has_one: [reply_to_post_content: {[through: [:replied, :reply_to_post_content]]}],
# has_one: [reply_to_creator_character: {[through: [:replied, :reply_to_creator_character]]}],
# has_one: [reply_to_creator_profile: {[through: [:replied, :reply_to_creator_profile]]}],
# has_one: [thread_post: {[through: [:replied, :thread_post]]}],
# has_one: [thread_post_content: {[through: [:replied, :thread_post_content]]}],
has_many: [direct_replies: {Replied, foreign_key: :reply_to_id, references: :object_id}],
has_one: [object_created: {Created, foreign_key: :id, references: :object_id}],
# has_one: [object_creator_user: {[through: [:object_created, :creator_user]]}],
# has_one: [object_creator_character: {[through: [:object_created, :creator_character]]}],
# has_one: [object_creator_profile: {[through: [:object_created, :creator_profile]]}],
has_one: [controlled: {Controlled, foreign_key: :id, references: :object_id}],
has_one: [activity: {Activity, foreign_key: :id, references: :id}], # ugly workaround needed for querying
many_to_many: [
tags: {
Bonfire.Tag,
join_through: "bonfire_tagged",
[code: quote do
@like_ulid "11KES11KET0BE11KEDY0VKN0WS"
@boost_ulid "300STANN0VNCERESHARESH0VTS"
@follow_ulid "70110WTHE1EADER1EADER1EADE"
# has_one :object_created, unquote(Created), foreign_key: :id
# belongs_to :object_peered, unquote(Peered), foreign_key: :id, define_field: false
# belongs_to :object_post, unquote(Post), foreign_key: :id, define_field: false
# belongs_to :object_post_content, unquote(PostContent), foreign_key: :id, define_field: false
# belongs_to :object_message, unquote(Message), foreign_key: :id, define_field: false
has_one :replied, unquote(Replied), foreign_key: :id, references: :object_id
# has_one: [reply_to: {[through: [:replied, :reply_to]]}],
# has_one: [reply_to_post: {[through: [:replied, :reply_to_post]]}],
# has_one: [reply_to_post_content: {[through: [:replied, :reply_to_post_content]]}],
# has_one: [reply_to_creator_character: {[through: [:replied, :reply_to_creator_character]]}],
# has_one: [reply_to_creator_profile: {[through: [:replied, :reply_to_creator_profile]]}],
# has_one: [thread_post: {[through: [:replied, :thread_post]]}],
# has_one: [thread_post_content: {[through: [:replied, :thread_post_content]]}],
# has_one: [object_creator_user: {[through: [:object_created, :creator_user]]}],
# has_one: [object_creator_character: {[through: [:object_created, :creator_character]]}],
# has_one: [object_creator_profile: {[through: [:object_created, :creator_profile]]}],
# ugly workaround needed for querying
has_one :activity, unquote(Activity), foreign_key: :id, references: :id
has_one :like_count, unquote(EdgeTotal), foreign_key: :id, references: :object_id, where: [table_id: @like_ulid]
has_one :boost_count, unquote(EdgeTotal), foreign_key: :id, references: :object_id, where: [table_id: @boost_ulid]
has_one :follow_count, unquote(EdgeTotal), foreign_key: :id, references: :object_id, where: [table_id: @follow_ulid]
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :object_id
has_many :tagged, unquote(Tagged), foreign_key: :id, references: :object_id
has_many :feed_publishes, unquote(FeedPublish), references: :id, foreign_key: :activity_id
many_to_many :tags, unquote(Pointer),
join_through: unquote(Tagged),
unique: true,
join_keys: [pointer_id: :object_id, tag_id: :id],
join_keys: [id: :object_id, tag_id: :id],
on_replace: :delete
}
]
end]
config :bonfire_data_social, Circle,
has_one: [caretaker: {Caretaker, foreign_key: :id}],
has_one: [named: {Named, foreign_key: :id}]
# has_many: [encircles: {Encircle, foreign_key: :circle_id}]
config :bonfire_data_social, Encircle,
belongs_to: [subject_user: {User, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_character: {Character, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_profile: {Profile, foreign_key: :subject_id, define_field: false}]
config :bonfire_data_social, Edge,
[code: quote do
unquote(edge)
# TODO: requires composite foreign keys:
# has_one :activity, unquote(Activity),
# foreign_key: [:table_id, :object_id], references: [:table_id, :object_id]
end]
config :bonfire_data_social, Feed,
belongs_to: [character: {Character, foreign_key: :id, define_field: false}],
belongs_to: [user: {User, foreign_key: :id, define_field: false}]
[code: quote do
# belongs_to :character, unquote(Character), foreign_key: :id, define_field: false
# belongs_to :user, unquote(User), foreign_key: :id, define_field: false
end]
config :bonfire_data_social, FeedPublish, []
config :bonfire_data_social, Follow,
belongs_to: [follower_character: {Character, foreign_key: :follower_id, define_field: false}],
belongs_to: [follower_profile: {Profile, foreign_key: :follower_id, define_field: false}],
belongs_to: [followed_character: {Character, foreign_key: :followed_id, define_field: false}],
belongs_to: [followed_profile: {Profile, foreign_key: :followed_id, define_field: false}]
config :bonfire_data_social, FollowCount, []
config :bonfire_data_social, Block, []
config :bonfire_data_social, Follow,
[code: quote do
has_one :created, unquote(Created), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
unquote(edges)
end]
# belongs_to: [follower_character: {Character, foreign_key: :follower_id, define_field: false}],
# belongs_to: [follower_profile: {Profile, foreign_key: :follower_id, define_field: false}],
# belongs_to: [followed_character: {Character, foreign_key: :followed_id, define_field: false}],
# belongs_to: [followed_profile: {Profile, foreign_key: :followed_id, define_field: false}]
config :bonfire_data_social, Block,
[code: quote do
unquote(edges)
end]
config :bonfire_data_social, Boost,
has_one: [activity: {Activity, foreign_key: :object_id, references: :boosted_id}] # requires an ON clause
[code: quote do
has_one :created, unquote(Created), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
unquote(edges)
end]
# has_one: [activity: {Activity, foreign_key: :object_id, references: :boosted_id}] # requires an ON clause
config :bonfire_data_social, Like,
has_one: [activity: {Activity, foreign_key: :object_id, references: :liked_id}] # requires an ON clause
[code: quote do
has_one :created, unquote(Created), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
unquote(edges)
end]
# has_one: [activity: {Activity, foreign_key: :object_id, references: :liked_id}] # requires an ON clause
config :bonfire_data_social, LikeCount, []
config :bonfire_data_social, Bookmark, []
config :bonfire_data_social, Flag,
[code: quote do
has_one :created, unquote(Created), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
unquote(edges)
end]
config :bonfire_data_social, Bookmark,
[code: quote do
unquote(edges)
end]
config :bonfire_data_social, Message,
has_one: [post_content: {PostContent, foreign_key: :id}],
has_one: [created: {Created, foreign_key: :id}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
has_many: [activities: {Activity, foreign_key: :object_id, references: :id}],
has_one: [activity: {Activity, foreign_key: :object_id, references: :id}], # requires an ON clause
has_one: [like_count: {LikeCount, foreign_key: :id}],
has_many: [likes: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_like: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_flag: {Flag, foreign_key: :flagged_id, references: :id}],
has_one: [replied: {Replied, foreign_key: :id}],
has_many: [direct_replies: {Replied, foreign_key: :reply_to_id}],
has_one: [controlled: {Controlled, foreign_key: :id}]
[code: quote do
@like_ulid "11KES11KET0BE11KEDY0VKN0WS"
@boost_ulid "300STANN0VNCERESHARESH0VTS"
has_one :post_content, unquote(PostContent), foreign_key: :id
has_one :created, unquote(Created), foreign_key: :id
has_one :peered, unquote(Peered), references: :id, foreign_key: :id
has_many :activities, unquote(Activity), foreign_key: :object_id, references: :id
has_one :activity, unquote(Activity), foreign_key: :object_id,
references: :id # requires an ON clause
has_one :replied, unquote(Replied), foreign_key: :id
has_one :like_count, unquote(EdgeTotal),
foreign_key: :id, references: :id, where: [table_id: @like_ulid]
has_one :boost_count, unquote(EdgeTotal),
foreign_key: :id, references: :id, where: [table_id: @boost_ulid]
has_many :direct_replies, unquote(Replied), foreign_key: :reply_to_id
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
has_many :tagged, unquote(Tagged), foreign_key: :id, references: :id
many_to_many :tags, unquote(Pointer),
join_through: unquote(Tagged),
unique: true,
join_keys: [id: :id, tag_id: :id],
on_replace: :delete
end]
config :bonfire_data_social, Mention, []
config :bonfire_data_social, Named, []
config :bonfire_data_social, Post,
has_one: [post_content: {PostContent, foreign_key: :id}],
has_one: [created: {Created, foreign_key: :id}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
# has_one: [creator_user: {[through: [:created, :creator_user]]}],
# has_one: [creator_character: {[through: [:created, :creator_character]]}],
# has_one: [creator_profile: {[through: [:created, :creator_profile]]}],
has_many: [activities: {Activity, foreign_key: :object_id, references: :id}],
has_one: [activity: {Activity, foreign_key: :object_id, references: :id}], # requires an ON clause
has_one: [like_count: {LikeCount, foreign_key: :id}],
has_many: [likes: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_like: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_boost: {Boost, foreign_key: :boosted_id, references: :id}],
has_one: [my_flag: {Flag, foreign_key: :flagged_id, references: :id}],
has_one: [replied: {Replied, foreign_key: :id}],
# has_one: [reply_to: {[through: [:replied, :reply_to]]}],
# has_one: [reply_to_post: {[through: [:replied, :reply_to_post]]}],
# has_one: [reply_to_post_content: {[through: [:replied, :reply_to_post_content]]}],
# has_one: [reply_to_creator_character: {[through: [:replied, :reply_to_creator_character]]}],
# has_one: [reply_to_creator_profile: {[through: [:replied, :reply_to_creator_profile]]}],
has_many: [direct_replies: {Replied, foreign_key: :reply_to_id}],
# has_one: [thread_post: {[through: [:replied, :thread_post]]}],
# has_one: [thread_post_content: {[through: [:replied, :thread_post_content]]}],
has_one: [controlled: {Controlled, foreign_key: :id}]
[code: quote do
@like_ulid "11KES11KET0BE11KEDY0VKN0WS"
@boost_ulid "300STANN0VNCERESHARESH0VTS"
has_one :caretaker, unquote(Caretaker), foreign_key: :id
has_one :post_content, unquote(PostContent), foreign_key: :id
has_one :created, unquote(Created), foreign_key: :id
has_one :peered, unquote(Peered), references: :id, foreign_key: :id
# has_one: [creator_user: {[through: [:created, :creator_user]]}],
# has_one: [creator_character: {[through: [:created, :creator_character]]}],
# has_one: [creator_profile: {[through: [:created, :creator_profile]]}],
has_many :activities, unquote(Activity), foreign_key: :object_id, references: :id
has_one :activity, unquote(Activity), foreign_key: :object_id, references: :id # requires an ON clause
has_one :replied, unquote(Replied), foreign_key: :id
# has_one: [reply_to: {[through: [:replied, :reply_to]]}],
# has_one: [reply_to_post: {[through: [:replied, :reply_to_post]]}],
# has_one: [reply_to_post_content: {[through: [:replied, :reply_to_post_content]]}],
# has_one: [reply_to_creator_character: {[through: [:replied, :reply_to_creator_character]]}],
# has_one: [reply_to_creator_profile: {[through: [:replied, :reply_to_creator_profile]]}],
has_many :direct_replies, unquote(Replied), foreign_key: :reply_to_id
# has_one: [thread_post: {[through: [:replied, :thread_post]]}],
# has_one: [thread_post_content: {[through: [:replied, :thread_post_content]]}],
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
has_one :like_count, unquote(EdgeTotal),
foreign_key: :id, references: :id, where: [table_id: @like_ulid]
has_one :boost_count, unquote(EdgeTotal),
foreign_key: :id, references: :id, where: [table_id: @boost_ulid]
has_many :tagged, unquote(Tagged), foreign_key: :id, references: :id
many_to_many :tags, unquote(Pointer),
join_through: unquote(Tagged),
unique: true,
join_keys: [id: :id, tag_id: :id],
on_replace: :delete
end]
config :bonfire_data_social, PostContent, []
config :bonfire_data_social, PostContent,
[code: quote do
field :hashtags, {:array, :any}, virtual: true # used in changesets
field :mentions, {:array, :any}, virtual: true # used in changesets
end]
config :bonfire_data_social, Replied,
belongs_to: [post: {Post, foreign_key: :id, define_field: false}],
belongs_to: [post_content: {PostContent, foreign_key: :id, define_field: false}],
has_many: [activities: {Activity, foreign_key: :object_id, references: :id}],
has_one: [activity: {Activity, foreign_key: :object_id, references: :id}],
has_one: [reply_to_post: {Post, foreign_key: :id, references: :reply_to_id}],
has_one: [reply_to_post_content: {PostContent, foreign_key: :id, references: :reply_to_id}],
has_one: [reply_to_created: {Created, foreign_key: :id, references: :reply_to_id}],
# has_one: [reply_to_creator_user: {[through: [:reply_to_created, :creator_user]]}],
# has_one: [reply_to_creator_character: {[through: [:reply_to_created, :creator_character]]}],
# has_one: [reply_to_creator_profile: {[through: [:reply_to_created, :creator_profile]]}],
# has_one: [like_count: {LikeCount, foreign_key: :id}],
has_many: [direct_replies: {Replied, foreign_key: :reply_to_id, references: :id}],
has_many: [thread_replies: {Replied, foreign_key: :thread_id, references: :id}],
has_one: [thread_post: {Post, foreign_key: :id, references: :thread_id}],
has_one: [thread_post_content: {PostContent, foreign_key: :id, references: :thread_id}],
has_one: [controlled: {Controlled, foreign_key: :id, references: :id}]
[code: quote do
@like_ulid "11KES11KET0BE11KEDY0VKN0WS"
@boost_ulid "300STANN0VNCERESHARESH0VTS"
belongs_to :post, unquote(Post), foreign_key: :id, define_field: false
belongs_to :post_content,unquote(PostContent), foreign_key: :id, define_field: false
has_many :activities, unquote(Activity), foreign_key: :object_id, references: :id
has_one :activity, unquote(Activity), foreign_key: :object_id, references: :id
field :replying_to, :map, virtual: true # used in changesets
has_one :reply_to_post, unquote(Post), foreign_key: :id, references: :reply_to_id
has_one :reply_to_post_content, unquote(PostContent), foreign_key: :id, references: :reply_to_id
has_one :reply_to_created, unquote(Created), foreign_key: :id, references: :reply_to_id
# has_one :reply_to_creator_user, through: [:reply_to_created, :creator_user]
# has_one :reply_to_creator_character, through: [:reply_to_created, :creator_character]
# has_one :reply_to_creator_profile, through: [:reply_to_created, :creator_profile]
has_many :direct_replies, unquote(Replied), foreign_key: :reply_to_id, references: :id
has_many :thread_replies, unquote(Replied), foreign_key: :thread_id, references: :id
has_one :thread_post, unquote(Post), foreign_key: :id, references: :thread_id
has_one :thread_post_content, unquote(PostContent), foreign_key: :id, references: :thread_id
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
has_one :like_count, unquote(EdgeTotal),
foreign_key: :id, references: :id, where: [table_id: @like_ulid]
has_one :boost_count, unquote(EdgeTotal),
foreign_key: :id, references: :id, where: [table_id: @boost_ulid]
end]
config :bonfire_data_social, Created,
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
belongs_to: [creator_user: {User, foreign_key: :creator_id, define_field: false}],
belongs_to: [creator_character: {Character, foreign_key: :creator_id, define_field: false}],
belongs_to: [creator_profile: {Profile, foreign_key: :creator_id, define_field: false}],
has_one: [post: {Post, references: :id, foreign_key: :id}]
[code: quote do
belongs_to :creator_user, unquote(User), foreign_key: :creator_id, define_field: false
belongs_to :creator_character, unquote(Character), foreign_key: :creator_id, define_field: false
belongs_to :creator_profile, unquote(Profile), foreign_key: :creator_id, define_field: false
has_one :peered, unquote(Peered), foreign_key: :id, references: :id
has_one :post, unquote(Post), foreign_key: :id, references: :id
end]
config :bonfire_data_social, Profile,
belongs_to: [user: {User, foreign_key: :id, define_field: false}],
has_one: [controlled: {Controlled, foreign_key: :id, references: :id}]
[code: quote do
belongs_to :user, unquote(User), foreign_key: :id, define_field: false
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
end]
######### other extensions
# optional mixin relations for tags that are characters (eg Category) or any other type of objects
config :bonfire_tag, Bonfire.Tag,
# for objects that are follow-able and can federate activities
has_one: [character: {Bonfire.Data.Identity.Character, references: :id, foreign_key: :id}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
# has_one: [actor: {Bonfire.Data.ActivityPub.Actor, references: :id, foreign_key: :id}],
has_one: [follow_count: {Bonfire.Data.Social.FollowCount, references: :id, foreign_key: :id}],
# for likeable objects
has_one: [like_count: {Bonfire.Data.Social.LikeCount, references: :id, foreign_key: :id}],
# name/description
has_one: [profile: {Bonfire.Data.Social.Profile, references: :id, foreign_key: :id}],
# for taxonomy categories/topics
has_one: [category: {Bonfire.Classify.Category, references: :id, foreign_key: :id}],
# for locations
has_one: [geolocation: {Bonfire.Geolocate.Geolocation, references: :id, foreign_key: :id}]
# add references of tagged objects to any Category
config :bonfire_classify, Bonfire.Classify.Category,
many_to_many: [
tags: {
Bonfire.Tag,
join_through: "bonfire_tagged",
config :bonfire_classify, Category,
[code: quote do
# has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
many_to_many :tags, unquote(Pointer),
join_through: unquote(Tagged),
unique: true,
join_keys: [tag_id: :id, pointer_id: :id],
join_keys: [tag_id: :id, id: :id],
on_replace: :delete
}
]
end]
config :bonfire_files, Media,
[code: quote do
field :url, :string, virtual: true
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
end]
# add references of tagged objects to any Geolocation
config :bonfire_geolocate, Bonfire.Geolocate.Geolocation,
many_to_many: [
tags: {
Bonfire.Tag,
join_through: "bonfire_tagged",
[code: quote do
# has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
many_to_many :tags, unquote(Pointer),
join_through: unquote(Tagged),
unique: true,
join_keys: [tag_id: :id, pointer_id: :id],
join_keys: [id: :id, tag_id: :id],
on_replace: :delete
}
]
config :bonfire_files, Bonfire.Files.Media,
field: [
url: {:string, virtual: true}
]
config :bonfire_valueflows, ValueFlows.Planning.Intent,
has_one: [like_count: {LikeCount, foreign_key: :id}]
end]

View file

@ -12,7 +12,6 @@ pointers = "https://github.com/bonfire-networks/pointers#main"
pointers_ulid = "https://github.com/bonfire-networks/pointers_ulid#main"
nodeinfo = "https://github.com/bonfire-networks/nodeinfo#main"
# surface = "https://github.com/bonfire-networks/surface"
bonfire_ui_social = "git@gitlab.com:msoe.edu/sdl/y22sdl/sdl-upcycle/bonfire_ui_social.git"
bonfire_quantify = "https://github.com/bonfire-networks/bonfire_quantify#main"
bonfire_geolocate = "https://github.com/bonfire-networks/bonfire_geolocate#main"
bonfire_valueflows = "https://github.com/bonfire-networks/bonfire_valueflows#main"
@ -47,5 +46,6 @@ bonfire_data_assort = "https://github.com/bonfire-networks/bonfire_data_assort"
# surface = "https://github.com/surface-ui/surface"
# surface_catalogue = "https://github.com/surface-ui/surface_catalogue" # Testing a UI component library
bonfire_editor_ck = "https://github.com/bonfire-networks/bonfire_editor_ck"
upcycle_ext = "git@gitlab.com:msoe.edu/sdl/y22sdl/sdl-upcycle/upcycle_ext.git"
bonfire_ui_social = "https://github.com/bonfire-networks/bonfire_ui_social#main"
# bonfire_ui_social = "https://gitlab.com/msoe.edu/sdl/y22sdl/sdl-upcycle/bonfire_ui_social#upcycle"
upcycle_ext = "https://gitlab.com/msoe.edu/sdl/y22sdl/sdl-upcycle/upcycle_ext#main"

View file

@ -1,7 +1,8 @@
# web
absinthe = "~> 1.7.0"
phoenix = "~> 1.6.2"
phoenix_live_view = "~> 0.16.4"
surface = "~> 0.6.1"
phoenix_live_view = "~> 0.17.0"
surface = "~> 0.7.0"
# livebook = "~> 0.2.3"
phoenix_html = "~> 3.0"
phoenix_ecto = "~> 4.4"

View file

@ -2,10 +2,14 @@ let ExtensionHooks = {};
// TODO: make this more configurable? ie. don't import disabled extensions
import { ThemeHooks } from "./../../../assets/js/theme"
import { CommonHooks } from "./../../../deps/bonfire_common/assets/js/extension"
import { InputSelectHooks } from "./../../../assets/js/input_select"
import { GeolocateHooks } from "./../../../deps/bonfire_geolocate/assets/js/extension"
import { KanbanHooks } from "./../../../deps/bonfire_ui_kanban/assets/js/extension"
Object.assign(ExtensionHooks, InputSelectHooks, GeolocateHooks, KanbanHooks)
// import { KanbanHooks } from "./../../../deps/bonfire_ui_kanban/assets/js/extension"
import { EditorCkHooks } from "./../../../deps/bonfire_editor_ck/assets/js/extension"
import { NotificationsHooks } from "./../../../assets/js/notifications"
Object.assign(ExtensionHooks, ThemeHooks, InputSelectHooks, CommonHooks, GeolocateHooks, EditorCkHooks, NotificationsHooks)
export { ExtensionHooks }

View file

@ -62,9 +62,10 @@ defmodule Bonfire.Web.Router do
use_if_enabled Bonfire.UI.Reflow.Routes
use_if_enabled Bonfire.UI.Coordination.Routes
use_if_enabled Bonfire.UI.Kanban.Routes
use_if_enabled Bonfire.Breadpub.Web.Routes
use_if_enabled Bonfire.Recyclapp.Routes
use_if_enabled Bonfire.UI.Kanban.Routes
use_if_enabled Bonfire.Upcycle.Web.Routes
# include GraphQL API
use_if_enabled Bonfire.GraphQL.Router

View file

@ -161,6 +161,7 @@
"tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
"unsafe": {:hex, :unsafe, "1.0.1", "a27e1874f72ee49312e0a9ec2e0b27924214a05e3ddac90e91727bc76f8613d8", [:mix], [], "hexpm", "6c7729a2d214806450d29766abc2afaa7a2cbecf415be64f36a6691afebb50e5"},
"upcycle_ext": {:git, "https://gitlab.com/msoe.edu/sdl/y22sdl/sdl-upcycle/upcycle_ext", "cb4fef61f5edfa6619ba8ab50ae1d60c321bb1d8", [branch: "main"]},
"verbs": {:git, "https://github.com/shannonwells/verbs_ex", "b492300006887c3df9cc56e3949a3474892ce480", []},
"voodoo": {:git, "https://github.com/bonfire-networks/voodoo", "a1ae5f3afdff7dc3507d160bce55ed9604796c93", [branch: "main"]},
"waffle": {:hex, :waffle, "1.1.5", "11b8b41c9dc46a21c8e1e619e1e9048d18d166b57b33d1fada8e11fcd4e678b3", [:mix], [{:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:ex_aws_s3, "~> 2.1", [hex: :ex_aws_s3, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: false]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "68e6f92b457b13c71e33cc23f7abb60446a01515dc6618b7d493d8cd466b1f39"},