Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
C
CommonsPub Federated Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bonfire
CommonsPub Federated Server
Commits
0cea1d47
Commit
0cea1d47
authored
Nov 11, 2020
by
Antonis Kalou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused aliases, fix small syntax issues
parent
27543490
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
15 additions
and
178 deletions
+15
-178
lib/extensions/collections/collection.ex
lib/extensions/collections/collection.ex
+1
-1
lib/extensions/communities/communities.ex
lib/extensions/communities/communities.ex
+0
-2
lib/extensions/tags/simulate.ex
lib/extensions/tags/simulate.ex
+0
-1
lib/extensions/value_flows/claim/graphql.ex
lib/extensions/value_flows/claim/graphql.ex
+1
-1
lib/extensions/value_flows/knowledge/process_specification/graphql.ex
...ns/value_flows/knowledge/process_specification/graphql.ex
+1
-38
lib/extensions/value_flows/knowledge/process_specification/process_specs.ex
...ue_flows/knowledge/process_specification/process_specs.ex
+0
-14
lib/extensions/value_flows/knowledge/resource_specification/graphql.ex
...s/value_flows/knowledge/resource_specification/graphql.ex
+1
-24
lib/extensions/value_flows/observation/event/events.ex
lib/extensions/value_flows/observation/event/events.ex
+0
-20
lib/extensions/value_flows/observation/process/processes.ex
lib/extensions/value_flows/observation/process/processes.ex
+8
-16
lib/extensions/value_flows/observation/resource/queries.ex
lib/extensions/value_flows/observation/resource/queries.ex
+1
-1
lib/extensions/value_flows/observation/resource/resource.ex
lib/extensions/value_flows/observation/resource/resource.ex
+1
-1
lib/extensions/value_flows/observation/resource/resources.ex
lib/extensions/value_flows/observation/resource/resources.ex
+0
-20
lib/extensions/value_flows/planning/intent/intent_graphql.ex
lib/extensions/value_flows/planning/intent/intent_graphql.ex
+0
-3
lib/extensions/value_flows/planning/intent/intents.ex
lib/extensions/value_flows/planning/intent/intents.ex
+0
-16
lib/extensions/value_flows/proposal/proposal_graphql.ex
lib/extensions/value_flows/proposal/proposal_graphql.ex
+0
-2
lib/extensions/value_flows/proposal/proposals.ex
lib/extensions/value_flows/proposal/proposals.ex
+0
-17
test/support/value_flows/faking.ex
test/support/value_flows/faking.ex
+1
-1
No files found.
lib/extensions/collections/collection.ex
View file @
0cea1d47
...
...
@@ -19,7 +19,7 @@ defmodule CommonsPub.Collections.Collection do
table_schema
"mn_collection"
do
# belongs_to(:actor, Character)
has_one
(
:character
,
C
ommonsPub
.
Characters
.
C
haracter
,
references:
:id
,
foreign_key:
:id
)
has_one
(
:character
,
Character
,
references:
:id
,
foreign_key:
:id
)
belongs_to
(
:creator
,
User
)
...
...
lib/extensions/communities/communities.ex
View file @
0cea1d47
...
...
@@ -24,8 +24,6 @@ defmodule CommonsPub.Communities do
alias
CommonsPub
.
Users
.
User
alias
CommonsPub
.
Workers
.
APPublishWorker
alias
CommonsPub
.
Utils
.
Web
.
CommonHelper
### Cursor generators
def
cursor
(
:followers
),
do
:
&
[
&1
.
follower_count
,
&1
.
id
]
...
...
lib/extensions/tags/simulate.ex
View file @
0cea1d47
...
...
@@ -3,7 +3,6 @@ defmodule CommonsPub.Tag.Simulate do
@moduledoc
false
import
CommonsPub
.
Utils
.
Simulation
import
CommonsPub
.
Utils
.
Trendy
alias
CommonsPub
.
Tag
.
Categories
...
...
lib/extensions/value_flows/claim/graphql.ex
View file @
0cea1d47
...
...
@@ -26,7 +26,7 @@ defmodule ValueFlows.Claim.GraphQL do
})
end
def
fetch_claim
(
info
,
id
)
do
def
fetch_claim
(
_
info
,
id
)
do
Claims
.
one
([
:default
,
id:
id
])
end
...
...
lib/extensions/value_flows/knowledge/process_specification/graphql.ex
View file @
0cea1d47
...
...
@@ -3,46 +3,20 @@ defmodule ValueFlows.Knowledge.ProcessSpecification.GraphQL do
require
Logger
alias
CommonsPub
.
{
# Activities,
# Communities,
GraphQL
,
Repo
# User
}
alias
CommonsPub
.
{
GraphQL
,
Repo
}
alias
CommonsPub
.
GraphQL
.
{
ResolveField
,
# ResolveFields,
# ResolvePage,
ResolvePages
,
ResolveRootPage
,
FetchPage
# FetchPages,
# CommonResolver
}
# alias CommonsPub.Resources.Resource
# alias CommonsPub.Common.Enums
alias
CommonsPub
.
Meta
.
Pointers
# alias CommonsPub.Communities.Community
# alias CommonsPub.Web.GraphQL.CommunitiesResolver
alias
ValueFlows
.
Knowledge
.
ProcessSpecification
alias
ValueFlows
.
Knowledge
.
ProcessSpecification
.
ProcessSpecifications
alias
ValueFlows
.
Knowledge
.
ProcessSpecification
.
Queries
# alias ValueFlows.Knowledge.Action.Actions
# alias CommonsPub.Web.GraphQL.CommonResolver
alias
CommonsPub
.
Web
.
GraphQL
.
UploadResolver
# SDL schema import
# use Absinthe.Schema.Notation
# import_sdl path: "lib/value_flows/graphql/schemas/planning.gql"
# TODO: put in config
# @tags_seperator " "
## resolvers
def
simulate
(%{
id:
_id
},
_
)
do
...
...
@@ -78,15 +52,9 @@ defmodule ValueFlows.Knowledge.ProcessSpecification.GraphQL do
end
def
process_specs_filtered
(
page_opts
,
_
)
do
IO
.
inspect
(
process_specs_filtered:
page_opts
)
process_specs_filter
(
page_opts
,
[])
end
# def process_specs_filtered(page_opts, _) do
# IO.inspect(unhandled_filtering: page_opts)
# all_process_specs(page_opts, nil)
# end
# TODO: support several filters combined, plus pagination on filtered queries
defp
process_specs_filter
(%{
in_scope_of:
context_id
}
=
page_opts
,
filters_acc
)
do
...
...
@@ -101,17 +69,12 @@ defmodule ValueFlows.Knowledge.ProcessSpecification.GraphQL do
_
,
filters_acc
)
do
# IO.inspect(filters_query: filters_acc)
# finally, if there's no more known params to acumulate, query with the filters
ProcessSpecifications
.
many
(
filters_acc
)
end
defp
process_specs_filter_next
(
param_remove
,
filter_add
,
page_opts
,
filters_acc
)
when
is_list
(
param_remove
)
and
is_list
(
filter_add
)
do
IO
.
inspect
(
process_specs_filter_next:
param_remove
)
IO
.
inspect
(
process_specs_filter_add:
filter_add
)
process_specs_filter
(
Map
.
drop
(
page_opts
,
param_remove
),
filters_acc
++
filter_add
)
end
...
...
lib/extensions/value_flows/knowledge/process_specification/process_specs.ex
View file @
0cea1d47
...
...
@@ -113,18 +113,6 @@ defmodule ValueFlows.Knowledge.ProcessSpecification.ProcessSpecifications do
end
end
defp
publish
(
creator
,
context
,
process_spec
,
activity
,
:created
)
do
feeds
=
[
context
.
outbox_id
,
CommonsPub
.
Feeds
.
outbox_id
(
creator
),
Feeds
.
instance_outbox_id
()
]
with
:ok
<-
FeedActivities
.
publish
(
activity
,
feeds
)
do
ap_publish
(
"create"
,
process_spec
.
id
,
creator
.
id
)
end
end
defp
publish
(
process_spec
,
:updated
)
do
# TODO: wrong if edited by admin
ap_publish
(
"update"
,
process_spec
.
id
,
process_spec
.
creator_id
)
...
...
@@ -145,8 +133,6 @@ defmodule ValueFlows.Knowledge.ProcessSpecification.ProcessSpecifications do
:ok
end
defp
ap_publish
(
_
,
_
,
_
),
do
:
:ok
# TODO: take the user who is performing the update
# @spec update(%ProcessSpecification{}, attrs :: map) :: {:ok, ProcessSpecification.t()} | {:error, Changeset.t()}
def
update
(%
ProcessSpecification
{}
=
process_spec
,
attrs
)
do
...
...
lib/extensions/value_flows/knowledge/resource_specification/graphql.ex
View file @
0cea1d47
...
...
@@ -4,43 +4,20 @@ defmodule ValueFlows.Knowledge.ResourceSpecification.GraphQL do
require
Logger
alias
CommonsPub
.
{
# Activities,
# Communities,
GraphQL
,
Repo
# User
}
alias
CommonsPub
.
{
GraphQL
,
Repo
}
alias
CommonsPub
.
GraphQL
.
{
ResolveField
,
# ResolveFields,
# ResolvePage,
ResolvePages
,
ResolveRootPage
,
FetchPage
# FetchPages,
# CommonResolver
}
# alias CommonsPub.Resources.Resource
# alias CommonsPub.Common.Enums
alias
CommonsPub
.
Meta
.
Pointers
# alias CommonsPub.Communities.Community
# alias CommonsPub.Web.GraphQL.CommunitiesResolver
alias
ValueFlows
.
Knowledge
.
ResourceSpecification
alias
ValueFlows
.
Knowledge
.
ResourceSpecification
.
ResourceSpecifications
alias
ValueFlows
.
Knowledge
.
ResourceSpecification
.
Queries
# alias ValueFlows.Knowledge.Action.Actions
# alias CommonsPub.Web.GraphQL.CommonResolver
alias
CommonsPub
.
Web
.
GraphQL
.
UploadResolver
# SDL schema import
# use Absinthe.Schema.Notation
# import_sdl path: "lib/value_flows/graphql/schemas/planning.gql"
## resolvers
def
simulate
(%{
id:
_id
},
_
)
do
...
...
lib/extensions/value_flows/observation/event/events.ex
View file @
0cea1d47
...
...
@@ -7,12 +7,6 @@ defmodule ValueFlows.Observation.EconomicEvent.EconomicEvents do
alias
CommonsPub
.
Contexts
alias
CommonsPub
.
Feeds
.
FeedActivities
alias
CommonsPub
.
Users
.
User
alias
CommonsPub
.
Meta
.
Pointers
alias
Geolocation
.
Geolocations
alias
ValueFlows
.
Knowledge
.
Action
.
Actions
alias
ValueFlows
.
Knowledge
.
ResourceSpecification
.
ResourceSpecifications
alias
ValueFlows
.
Observation
.
EconomicEvent
alias
ValueFlows
.
Observation
.
EconomicResource
.
EconomicResources
...
...
@@ -421,18 +415,6 @@ defmodule ValueFlows.Observation.EconomicEvent.EconomicEvents do
end
end
defp
publish
(
creator
,
context
,
event
,
activity
,
:created
)
do
feeds
=
[
context
.
outbox_id
,
CommonsPub
.
Feeds
.
outbox_id
(
creator
),
Feeds
.
instance_outbox_id
()
]
with
:ok
<-
FeedActivities
.
publish
(
activity
,
feeds
)
do
ap_publish
(
"create"
,
event
.
id
,
creator
.
id
)
end
end
defp
publish
(
event
,
:updated
)
do
# TODO: wrong if edited by admin
ap_publish
(
"update"
,
event
.
id
,
event
.
creator_id
)
...
...
@@ -453,8 +435,6 @@ defmodule ValueFlows.Observation.EconomicEvent.EconomicEvents do
:ok
end
defp
ap_publish
(
_
,
_
,
_
),
do
:
:ok
def
indexing_object_format
(
obj
)
do
%{
"index_type"
=>
"EconomicEvent"
,
...
...
lib/extensions/value_flows/observation/process/processes.ex
View file @
0cea1d47
...
...
@@ -87,7 +87,8 @@ defmodule ValueFlows.Observation.Process.Processes do
def
trace
(
process
),
do
:
inputs
(
process
)
def
inputs
(%{
id:
id
},
action_id
\\
nil
)
when
not
is_nil
(
action_id
)
do
def
inputs
(
attrs
,
action_id
\\
nil
)
def
inputs
(%{
id:
id
},
action_id
)
when
not
is_nil
(
action_id
)
do
EconomicEvents
.
many
([
:default
,
input_of_id:
id
,
action_id:
action_id
])
end
...
...
@@ -95,7 +96,12 @@ defmodule ValueFlows.Observation.Process.Processes do
EconomicEvents
.
many
([
:default
,
input_of_id:
id
])
end
def
outputs
(%{
id:
id
},
action_id
\\
nil
)
when
not
is_nil
(
action_id
)
do
def
inputs
(
_
,
_
)
do
{
:ok
,
nil
}
end
def
outputs
(
attrs
,
action_id
\\
nil
)
def
outputs
(%{
id:
id
},
action_id
)
when
not
is_nil
(
action_id
)
do
EconomicEvents
.
many
([
:default
,
output_of_id:
id
,
action_id:
action_id
])
end
...
...
@@ -143,18 +149,6 @@ defmodule ValueFlows.Observation.Process.Processes do
end
end
defp
publish
(
creator
,
context
,
process
,
activity
,
:created
)
do
feeds
=
[
context
.
outbox_id
,
CommonsPub
.
Feeds
.
outbox_id
(
creator
),
Feeds
.
instance_outbox_id
()
]
with
:ok
<-
FeedActivities
.
publish
(
activity
,
feeds
)
do
ap_publish
(
"create"
,
process
.
id
,
creator
.
id
)
end
end
defp
publish
(
process
,
:updated
)
do
# TODO: wrong if edited by admin
ap_publish
(
"update"
,
process
.
id
,
process
.
creator_id
)
...
...
@@ -175,8 +169,6 @@ defmodule ValueFlows.Observation.Process.Processes do
:ok
end
defp
ap_publish
(
_
,
_
,
_
),
do
:
:ok
# TODO: take the user who is performing the update
# @spec update(%Process{}, attrs :: map) :: {:ok, Process.t()} | {:error, Changeset.t()}
def
update
(%
Process
{}
=
process
,
attrs
)
do
...
...
lib/extensions/value_flows/observation/resource/queries.ex
View file @
0cea1d47
...
...
@@ -46,7 +46,7 @@ defmodule ValueFlows.Observation.EconomicResource.Queries do
join
(
q
,
:inner
,
[
resource:
r
],
e
in
EconomicEvent
,
as:
:event
,
on:
e
.
resource_inventoried_as_id
==
r
.
id
and
e
.
output_of_id
==
^
output_of_id
,
on:
e
.
resource_inventoried_as_id
==
r
.
id
and
e
.
output_of_id
==
^
output_of_id
)
end
...
...
lib/extensions/value_flows/observation/resource/resource.ex
View file @
0cea1d47
...
...
@@ -14,7 +14,7 @@ defmodule ValueFlows.Observation.EconomicResource do
alias
ValueFlows
.
Knowledge
.
Action
alias
ValueFlows
.
Knowledge
.
ResourceSpecification
alias
ValueFlows
.
Knowledge
.
ProcessSpecification
#
alias ValueFlows.Knowledge.ProcessSpecification
alias
ValueFlows
.
Observation
.
EconomicResource
...
...
lib/extensions/value_flows/observation/resource/resources.ex
View file @
0cea1d47
...
...
@@ -7,16 +7,10 @@ defmodule ValueFlows.Observation.EconomicResource.EconomicResources do
alias
CommonsPub
.
Contexts
alias
CommonsPub
.
Feeds
.
FeedActivities
alias
CommonsPub
.
Users
.
User
alias
CommonsPub
.
Meta
.
Pointers
alias
Geolocation
.
Geolocations
alias
Measurement
.
Unit
.
Units
alias
ValueFlows
.
Knowledge
.
ResourceSpecification
.
ResourceSpecifications
alias
ValueFlows
.
Knowledge
.
ProcessSpecification
.
ProcessSpecifications
alias
ValueFlows
.
Observation
.
EconomicResource
alias
ValueFlows
.
Observation
.
EconomicResource
.
Queries
alias
ValueFlows
.
Observation
.
EconomicEvent
.
EconomicEvents
alias
ValueFlows
.
Knowledge
.
Action
.
Actions
def
cursor
(),
do
:
&
[
&1
.
id
]
def
test_cursor
(),
do
:
&
[
&1
[
"id"
]]
...
...
@@ -170,18 +164,6 @@ defmodule ValueFlows.Observation.EconomicResource.EconomicResources do
end
end
defp
publish
(
creator
,
context
,
resource
,
activity
,
:created
)
do
feeds
=
[
context
.
outbox_id
,
CommonsPub
.
Feeds
.
outbox_id
(
creator
),
Feeds
.
instance_outbox_id
()
]
with
:ok
<-
FeedActivities
.
publish
(
activity
,
feeds
)
do
ap_publish
(
"create"
,
resource
.
id
,
creator
.
id
)
end
end
defp
publish
(
resource
,
:updated
)
do
# TODO: wrong if edited by admin
ap_publish
(
"update"
,
resource
.
id
,
resource
.
creator_id
)
...
...
@@ -202,8 +184,6 @@ defmodule ValueFlows.Observation.EconomicResource.EconomicResources do
:ok
end
defp
ap_publish
(
_
,
_
,
_
),
do
:
:ok
def
indexing_object_format
(
obj
)
do
# icon = CommonsPub.Uploads.remote_url_from_id(obj.icon_id)
image
=
CommonsPub
.
Uploads
.
remote_url_from_id
(
obj
.
image_id
)
...
...
lib/extensions/value_flows/planning/intent/intent_graphql.ex
View file @
0cea1d47
...
...
@@ -14,12 +14,9 @@ defmodule ValueFlows.Planning.Intent.GraphQL do
FetchPage
}
alias
CommonsPub
.
Meta
.
Pointers
alias
ValueFlows
.
Planning
.
Intent
alias
ValueFlows
.
Planning
.
Intent
.
Intents
alias
ValueFlows
.
Planning
.
Intent
.
Queries
alias
ValueFlows
.
Knowledge
.
Action
.
Actions
alias
CommonsPub
.
Web
.
GraphQL
.
UploadResolver
## resolvers
...
...
lib/extensions/value_flows/planning/intent/intents.ex
View file @
0cea1d47
...
...
@@ -7,9 +7,7 @@ defmodule ValueFlows.Planning.Intent.Intents do
alias
CommonsPub
.
Contexts
alias
CommonsPub
.
Feeds
.
FeedActivities
alias
CommonsPub
.
Users
.
User
alias
CommonsPub
.
Meta
.
Pointers
alias
Geolocation
.
Geolocations
alias
ValueFlows
.
Knowledge
.
Action
.
Actions
alias
ValueFlows
.
Planning
.
Intent
alias
ValueFlows
.
Planning
.
Intent
.
Queries
...
...
@@ -126,18 +124,6 @@ defmodule ValueFlows.Planning.Intent.Intents do
end
end
defp
publish
(
creator
,
context
,
intent
,
activity
,
:created
)
do
feeds
=
[
context
.
outbox_id
,
CommonsPub
.
Feeds
.
outbox_id
(
creator
),
Feeds
.
instance_outbox_id
()
]
with
:ok
<-
FeedActivities
.
publish
(
activity
,
feeds
)
do
ap_publish
(
"create"
,
intent
.
id
,
creator
.
id
)
end
end
defp
publish
(
intent
,
:updated
)
do
# TODO: wrong if edited by admin
ap_publish
(
"update"
,
intent
.
id
,
intent
.
creator_id
)
...
...
@@ -158,8 +144,6 @@ defmodule ValueFlows.Planning.Intent.Intents do
:ok
end
defp
ap_publish
(
_
,
_
,
_
),
do
:
:ok
# TODO: take the user who is performing the update
# @spec update(%Intent{}, attrs :: map) :: {:ok, Intent.t()} | {:error, Changeset.t()}
def
update
(%
Intent
{}
=
intent
,
attrs
)
do
...
...
lib/extensions/value_flows/proposal/proposal_graphql.ex
View file @
0cea1d47
...
...
@@ -13,8 +13,6 @@ defmodule ValueFlows.Proposal.GraphQL do
FetchPage
}
alias
CommonsPub
.
Meta
.
Pointers
alias
ValueFlows
.
Proposal
.
Proposals
## resolvers
...
...
lib/extensions/value_flows/proposal/proposals.ex
View file @
0cea1d47
...
...
@@ -8,8 +8,6 @@ defmodule ValueFlows.Proposal.Proposals do
alias
CommonsPub
.
Feeds
.
FeedActivities
alias
CommonsPub
.
Users
.
User
alias
Geolocation
.
Geolocations
# alias Measurement.Measure
alias
ValueFlows
.
Proposal
alias
ValueFlows
.
Proposal
...
...
@@ -23,9 +21,6 @@ defmodule ValueFlows.Proposal.Proposals do
alias
ValueFlows
.
Planning
.
Intent
# use Assertions.AbsintheCase, async: true, schema: ValueFlows.Schema
# import Assertions.Absinthe, only: [document_for: 4]
@schema
CommonsPub
.
Web
.
GraphQL
.
Schema
def
cursor
(),
do
:
&
[
&1
.
id
]
...
...
@@ -153,18 +148,6 @@ defmodule ValueFlows.Proposal.Proposals do
end
end
defp
publish
(
creator
,
context
,
proposal
,
activity
,
:created
)
do
feeds
=
[
context
.
outbox_id
,
CommonsPub
.
Feeds
.
outbox_id
(
creator
),
Feeds
.
instance_outbox_id
()
]
with
:ok
<-
FeedActivities
.
publish
(
activity
,
feeds
)
do
ap_publish
(
"create"
,
proposal
.
id
,
creator
.
id
)
end
end
defp
publish
(
proposal
,
:updated
)
do
# TODO: wrong if edited by admin
ap_publish
(
"update"
,
proposal
.
id
,
proposal
.
creator_id
)
...
...
test/support/value_flows/faking.ex
View file @
0cea1d47
...
...
@@ -72,7 +72,7 @@ defmodule ValueFlows.Test.Faking do
finished:
assert_optional
(
&
assert_boolean
/
1
),
created:
assert_optional
(
&
assert_datetime
/
1
),
due:
assert_optional
(
&
assert_datetime
/
1
),
resource_classified_as:
assert_optional
(
assert_list
(
&
assert_url
/
1
))
,
resource_classified_as:
assert_optional
(
assert_list
(
&
assert_url
/
1
))
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment