Verified Commit 090627d2 authored by Rigel Kent's avatar Rigel Kent
Browse files

(back) adding graphql-cli config and schema.graphql

parent 24b4db84
Pipeline #157054 failed with stages
in 5 minutes and 53 seconds
DATABASE_URL="postgresql://olki@postgres/test_olki"
SECRET="ci"
......@@ -20,13 +20,14 @@ variables:
## Jobs templates
#
.tests: &tests
.tests:
stage: test
variables:
# Note that any variable passed down to tox must be whitelisted
# in `olki_back/setup.cfg`'s passenv. Hence using a CI dotfile.
DOTFILE: '.env.ci'
except:
- schedules
#dependencies:
# - lint
# - build
###
## Build and lint
......@@ -40,17 +41,17 @@ build:
script:
- make build-fe
artifacts:
expire_in: 1day
expire_in: 1 day
paths:
- olki_front/dist/
#lint:
# stage: lint
# except:
# - schedules
# script:
# - make deps-dev-be
# - poetry run therapist run lint-all
.lint:
stage: lint
except:
- schedules
script:
- make deps-dev-be
- poetry run therapist run lint-all
reuse:
image: fsfe/reuse:latest
......@@ -80,22 +81,19 @@ reuse:
#
back:
<<: *tests
extends: .tests
services:
- postgres:latest
variables:
# Note that any variable passed down to tox must be whitelisted
# in `olki_back/setup.cfg`'s passenv. Hence using a CI dotfile.
DOTFILE: '.env.ci'
- postgres:11
before_script:
- cp -R /.venv .
- make deps-dev-be
- make manage -- migrate
- ~/.poetry/bin/poetry config settings.virtualenvs.path .venv
script:
- make test-be-pytest-only
front:
<<: *tests
extends: .tests
image: node:current
before_script:
- make deps-dev-fe
......
......@@ -7,6 +7,16 @@ Files: *
Copyright: 2019 Pierre-Antoine Rault <par@rigelk.eu>
License: AGPL-3.0-or-later
# This application uses Open Source components. You can find the source code of
# their open source projects along with license information below. We acknowledge
# and are grateful to these developers for their contributions to open source.
Files: olki_back/olki/apps/federation/*
Copyright: 2019 Eliot Beriot
2019 Pierre-Antoine Rault <par@rigelk.eu>
License: AGPL-3.0-or-later
Comment: code was from funkwhale@49769819265170a771e747b8696de6a27a100379
Files: olki_front/static/fonts/Inter*
Copyright: 2016 The Inter Project Authors <me@rsms.me>
License: OFL-1.1
......
......@@ -65,12 +65,11 @@ We also reserve the right to temporarily or permanently ban any contributor for
This code of conduct applies whenever you are representing the project or community. For example you may be:
* working in a project space online or in the public (i.e.: github.com, framacolibri.org, IRC)
* using an official project email address
* working in a project space online or in the public (i.e.: framagit.org, matrix.org, group sessions)
* posting via an official social media account
* participating in an online or offline event
* participating in an online or offline event representing or even just linked to the project
Project maintainers may further define and clarify representation of a project.
Project maintainers may further define and clarify representations of the project.
## Enforcement
......
## Credits
This application uses Open Source components. You can find the source code of
their open source projects along with license information below. We acknowledge
and are grateful to these developers for their contributions to open source.
Project: Funkwhale https://dev.funkwhale.audio/funkwhale/funkwhale
License (AGPLv3.0 only) https://dev.funkwhale.audio/funkwhale/funkwhale/blob/0.17/LICENSE
Usage: part of the federation and HTTP signature code
This diff is collapsed.
......@@ -107,6 +107,7 @@ deps-dev:
deps-dev-be:
@command -v poetry >/dev/null 2>&1 || curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python # if we lack poetry, we can install it
@poetry config settings.virtualenvs.in-project true
ifndef CI
@cd olki_back ; poetry install --no-interaction # backend dependencies (python)
@poetry run therapist install
......
{
"projects": {
"OLKi": {
"schemaPath": "schema.graphql",
"extensions": {
"endpoints": {
"default": "http://localhost:5000/graphql"
}
}
}
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
SECRET_KEY = os.getenv('SECRET')
SECRET_KEY = env.str('SECRET', os.getenv('SECRET'))
# ROLES / PERMISSIONS
# -------------------------------------------------------------------------------
......
# source: http://localhost:5000/graphql
# timestamp: Wed Aug 07 2019 17:25:08 GMT+0200 (Central European Summer Time)
schema {
query: Queries
mutation: Mutations
}
"""This is an Action as defined in Django Activity Streams."""
type Action implements Node {
"""The ID of the object."""
id: ID!
actorObjectId: String!
verb: String!
"""
A field used to store annex data, for instance describing the fields changed on the target during an Update.
"""
description: JSONString
targetObjectId: String
actionObjectObjectId: String
timestamp: DateTime!
actor: Actor
actorId: String
target: ActionTargetUnion
object: ActionObjectUnion
objectDeleted: Boolean
}
type ActionConnection {
"""Pagination data for this connection."""
pageInfo: PageInfo!
"""Contains the nodes in this connection."""
edges: [ActionEdge]!
totalCount: Int
}
"""A Relay edge containing a `Action` and its cursor."""
type ActionEdge {
"""The item at the end of the edge"""
node: Action
"""A cursor for use in pagination"""
cursor: String!
}
"""A list of possible models that can be considered as objects."""
union ActionObjectUnion = Note
interface ActionTargetInterface {
pk: String
title: String!
}
"""A list of possible models that can be considered as targets."""
union ActionTargetUnion = Corpus
"""Mutation to activate a user's registration"""
type Activate {
success: Boolean
errors: [String]
}
"""This is an Actor."""
type Actor implements Node {
name: String
summary: String
"""The ID of the object."""
id: ID!
username: String
fullUsername: String
profileUrl: String
}
interface AuthorInterface {
name: String!
orcid: String
}
"""Mutation for changing password"""
type ChangePassword {
success: Boolean
}
"""
This is a Corpus. It contains files, metadata describing them, and discussions around them.
"""
type Corpus implements Node & ActionTargetInterface {
createdAt: DateTime!
updatedAt: DateTime!
"""The id or URL of the resource used as a base for this Corpus."""
clonedFrom: String
title: String!
description: String
"""An [SDPX license](https://spdx.org/licenses/) identifier."""
license: String
"""An [iso639-1](https://en.wikipedia.org/wiki/ISO_639-1) code."""
language: String!
"""The DOI or DOI URL of the Corpus."""
digitalObjectIdentifier: String
"""Optional original date of publication, if any."""
originalPublicationAt: DateTime
"""
A list of related URI/identifiers with their DataCite Metadata Scheme as a value.
"""
related: JSONString
draft: Boolean!
commentsAllowed: Boolean!
commentsOnlyLocal: Boolean!
commentsOnlyVisibleIfApproved: Boolean!
"""The ID of the object."""
id: ID!
"""A Flax ID that is used as a primary key for the model."""
pk: String
actor: Actor
authors: [CorpusAuthor]
tags: [Tag]
"""Files of a Corpus which are publicly available, and their metadata."""
files: [File]
commentsCount: Int
}
type CorpusAuthor implements Node {
email: String
affiliation: String
role: String
"""The ID of the object."""
id: ID!
name: String
orcid: String
}
type CorpusConnection {
"""Pagination data for this connection."""
pageInfo: PageInfo!
"""Contains the nodes in this connection."""
edges: [CorpusEdge]!
totalCount: Int
}
"""A Relay edge containing a `Corpus` and its cursor."""
type CorpusEdge {
"""The item at the end of the edge"""
node: Corpus
"""A cursor for use in pagination"""
cursor: String!
}
input CreateActorInput {
username: String!
clientMutationId: String
}
"""Mutation to initialize an account's actor"""
type CreateActorPayload {
username: String!
errors: [ErrorType]
clientMutationId: String
}
input CreateCorpusInput {
"""
A list of file GUIDs that have already been uploaded to the TUS server.
"""
files: [UUID]
title: String!
description: String
"""The DOI or DOI URL of the Corpus."""
digitalObjectIdentifier: String
"""An [SDPX license](https://spdx.org/licenses/) identifier."""
license: String
"""An [iso639-1](https://en.wikipedia.org/wiki/ISO_639-1) code."""
language: String!
draft: Boolean
"""
A list of related URI/identifiers with their DataCite Metadata Scheme as a value.
"""
related: String
commentsAllowed: Boolean
commentsOnlyLocal: Boolean
commentsOnlyVisibleIfApproved: Boolean
"""Optional original date of publication, if any."""
originalPublicationAt: DateTime
tags: String
authors: String
clientMutationId: String
}
"""Mutation to initialize a Corpus"""
type CreateCorpusPayload {
corpus: Corpus
errors: [ErrorType]
clientMutationId: String
}
input CreateNoteInput {
"""
A Flax ID that is used as a primary key for the Corpus model the Note references.
"""
pk: String!
"""Subject of the Note."""
name: String
"""Text of the Note."""
content: String!
"""A list of tags with a WikiData key and their english name as a value."""
tags: String
language: String
clientMutationId: String
}
type CreateNotePayload {
note: Note
errors: [ErrorType]
clientMutationId: String
}
"""
The `DateTime` scalar type represents a DateTime
value as specified by
[iso8601](https://en.wikipedia.org/wiki/ISO_8601).
"""
scalar DateTime
"""Mutation to delete an account"""
type DeleteAccount {
success: Boolean
errors: [String]
}
"""Mutation to delete a corpus"""
type DeleteCorpus {
success: Boolean
errors: [String]
}
"""
Mutation to delete a Note. It doesn't delete the Note object, but
rather switches its visibility to False
"""
type DeleteNote {
success: Boolean
errors: [String]
}
"""Debugging information for the current query."""
type DjangoDebug {
"""Executed SQL queries for this API query."""
sql: [DjangoDebugSQL]
}
"""Represents a single database query made to a Django managed DB."""
type DjangoDebugSQL {
"""The type of database being used (e.g. postrgesql, mysql, sqlite)."""
vendor: String!
"""The Django database alias (e.g. 'default')."""
alias: String!
"""The actual SQL sent to this database."""
sql: String
"""Duration of this database query in seconds."""
duration: Float!
"""The raw SQL of this query, without params."""
rawSql: String!
"""JSON encoded database query parameters."""
params: String!
"""Start time of this database query."""
startTime: Float!
"""Stop time of this database query."""
stopTime: Float!
"""Whether this database query took more than 10 seconds."""
isSlow: Boolean!
"""Whether this database query was a SELECT."""
isSelect: Boolean!
"""Postgres transaction ID if available."""
transId: String
"""Postgres transaction status if available."""
transStatus: String
"""Postgres isolation level if available."""
isoLevel: String
"""Postgres connection encoding if available."""
encoding: String
}
input EditCorpusInput {
"""
A list of file GUIDs that have already been uploaded to the TUS server.
"""
files: [UUID]
"""A Flax ID that is used as a primary key for the model."""
pk: String!
title: String!
description: String
"""The DOI or DOI URL of the Corpus."""
digitalObjectIdentifier: String
"""An [SDPX license](https://spdx.org/licenses/) identifier."""
license: String
"""An [iso639-1](https://en.wikipedia.org/wiki/ISO_639-1) code."""
language: String!
draft: Boolean
"""
A list of related URI/identifiers with their DataCite Metadata Scheme as a value.
"""
related: String
commentsAllowed: Boolean
commentsOnlyLocal: Boolean
commentsOnlyVisibleIfApproved: Boolean
"""Optional original date of publication, if any."""
originalPublicationAt: DateTime
tags: String
authors: String
clientMutationId: String
}
"""Mutation to edit an existing corpus"""
type EditCorpusPayload {
corpus: Corpus
errors: [ErrorType]
clientMutationId: String
}
type ErrorType {
field: String!
messages: [String!]!
}
"""A file of a Corpus."""
type File {
filetype: String
hash: String
name: String
description: String
url: String
size: Int
}
"""
The `GenericScalar` scalar type represents a generic
GraphQL scalar value that could be:
String, Boolean, Int, Float, List or Object.
"""
scalar GenericScalar
input GlobalPreferencesMutationInput {
"""Site title, displayed and shared to indentify the instance."""
general_SiteTitle: String
"""
Site description, necessary to present the purpose of your instance to
potential users, or other admins wishing to federate with you.
"""
general_SiteDescription: String
"""
Site terms of service, necessary to present the terms under which you provide service to potential users.
"""
general_SiteTos: String
"""
Site rules, necessary to present the terms under which you moderate content.
"""
general_SiteRules: String
"""
Allow new users to register on the public page. Doesn't affect LDAP/CAS nor invitations.
"""
general_RegistrationAllowed: Boolean
clientMutationId: String
}
type GlobalPreferencesMutationPayload {
"""Site title, displayed and shared to indentify the instance."""
general_SiteTitle: String
"""
Site description, necessary to present the purpose of your instance to
potential users, or other admins wishing to federate with you.
"""
general_SiteDescription: String
"""
Site terms of service, necessary to present the terms under which you provide service to potential users.
"""
general_SiteTos: String
"""
Site rules, necessary to present the terms under which you moderate content.
"""
general_SiteRules: String
"""
Allow new users to register on the public page. Doesn't affect LDAP/CAS nor invitations.
"""
general_RegistrationAllowed: Boolean
errors: [ErrorType]
clientMutationId: String
}
"""
Allows use of a JSON String for input / output from the GraphQL schema.
Use of this type is *not recommended* as you lose the benefits of having a defined, static
schema (one of the key benefits of GraphQL).
"""
scalar JSONString
"""Mutation to login a user"""
type Login {
success: Boolean
errors: [String]
token: String
user: User
}
"""
Mutations wrapper
This class inherits from multiple Mutations
as we add more apps mutations to our project
Note it is an instance (graphene.ObjectType)
inheriting from interfaces (graphene.AbstractType)
"""
type Mutations {
createNote(input: CreateNoteInput!): CreateNotePayload
"""
Mutation to delete a Note. It doesn't delete the Note object, but
rather switches its visibility to False
"""
deleteNote(pk: String!): DeleteNote
"""Mutation to initialize a Corpus"""
createCorpus(input: CreateCorpusInput!): CreateCorpusPayload
"""Mutation to edit an existing corpus"""
editCorpus(input: EditCorpusInput!): EditCorpusPayload
"""Mutation to delete a corpus"""
deleteCorpus(