Merge branch 'master' into feature/groups

This commit is contained in:
Alexandre Bodin 2019-07-09 16:11:01 +02:00
commit 8ece6eaa22
6 changed files with 441 additions and 8 deletions

View File

@ -11,12 +11,18 @@
"comment": ""
},
"attributes": {
"content2": {
"type": "text"
},
"title": {
"type": "string"
},
"content": {
"type": "text"
},
"published": {
"type": "boolean"
},
"value": {
"type": "integer"
},
"image": {
"model": "file",
"via": "related",

View File

@ -22,6 +22,19 @@ const postgres = {
options: {},
};
const mysql = {
connector: 'strapi-hook-bookshelf',
settings: {
client: 'mysql',
database: 'strapi',
username: 'strapi',
password: 'strapi',
port: 3306,
host: 'localhost',
},
options: {},
};
const mongo = {
connector: 'strapi-hook-mongoose',
settings: {
@ -35,6 +48,7 @@ const mongo = {
};
const db = {
mysql,
sqlite,
postgres,
mongo,

View File

@ -0,0 +1,397 @@
type Articles {
id: ID!
created_at: DateTime!
updated_at: DateTime!
content2: String
title: String
image: UploadFile
mainTag: Tag
linkedTags(sort: String, limit: Int, start: Int, where: JSON): [Tag]
manyTags(sort: String, limit: Int, start: Int, where: JSON): [Tag]
}
input ArticlesInput {
content2: String
title: String
image: ID
mainTag: ID
linkedTags: [ID]
manyTags: [ID]
}
input createArticlesInput {
data: ArticlesInput
}
type createArticlesPayload {
article: Articles
}
input createPostInput {
data: PostInput
}
type createPostPayload {
post: Post
}
input createRoleInput {
data: RoleInput
}
type createRolePayload {
role: UsersPermissionsRole
}
input createTagInput {
data: TagInput
}
type createTagPayload {
tag: Tag
}
input createUserInput {
data: UserInput
}
type createUserPayload {
user: UsersPermissionsUser
}
"""
The `DateTime` scalar represents a date and time following the ISO 8601 standard
"""
scalar DateTime
input deleteArticlesInput {
where: InputID
}
type deleteArticlesPayload {
article: Articles
}
input deletePostInput {
where: InputID
}
type deletePostPayload {
post: Post
}
input deleteRoleInput {
where: InputID
}
type deleteRolePayload {
role: UsersPermissionsRole
}
input deleteTagInput {
where: InputID
}
type deleteTagPayload {
tag: Tag
}
input deleteUserInput {
where: InputID
}
type deleteUserPayload {
user: UsersPermissionsUser
}
input editArticlesInput {
content2: String
title: String
image: ID
mainTag: ID
linkedTags: [ID]
manyTags: [ID]
}
input editFileInput {
name: String
hash: String
sha256: String
ext: String
mime: String
size: String
url: String
provider: String
public_id: String
related: [ID]
}
input editPostInput {
title: String
}
input editRoleInput {
name: String
description: String
type: String
permissions: [ID]
users: [ID]
}
input editTagInput {
name: String
linkedArticles: [ID]
}
input editTestInput {
type: String
}
input editUserInput {
username: String
email: String
provider: String
password: String
resetPasswordToken: String
confirmed: Boolean
blocked: Boolean
role: ID
}
input FileInput {
name: String!
hash: String!
sha256: String
ext: String
mime: String!
size: String!
url: String!
provider: String!
public_id: String
related: [ID]
}
input InputID {
id: ID!
}
scalar JSON
"""The `Long` scalar type represents 52-bit integers"""
scalar Long
union Morph = UsersPermissionsMe | UsersPermissionsMeRole | Articles | createArticlesPayload | updateArticlesPayload | deleteArticlesPayload | Post | createPostPayload | updatePostPayload | deletePostPayload | Tag | createTagPayload | updateTagPayload | deleteTagPayload | UploadFile | UsersPermissionsPermission | UsersPermissionsRole | createRolePayload | updateRolePayload | deleteRolePayload | UsersPermissionsUser | createUserPayload | updateUserPayload | deleteUserPayload | MypluginTest
type Mutation {
createArticles(input: createArticlesInput): createArticlesPayload
updateArticles(input: updateArticlesInput): updateArticlesPayload
deleteArticles(input: deleteArticlesInput): deleteArticlesPayload
createPost(input: createPostInput): createPostPayload
updatePost(input: updatePostInput): updatePostPayload
deletePost(input: deletePostInput): deletePostPayload
createTag(input: createTagInput): createTagPayload
updateTag(input: updateTagInput): updateTagPayload
deleteTag(input: deleteTagInput): deleteTagPayload
"""Create a new role"""
createRole(input: createRoleInput): createRolePayload
"""Update an existing role"""
updateRole(input: updateRoleInput): updateRolePayload
"""Delete an existing role"""
deleteRole(input: deleteRoleInput): deleteRolePayload
"""Create a new user"""
createUser(input: createUserInput): createUserPayload
"""Update an existing user"""
updateUser(input: updateUserInput): updateUserPayload
"""Delete an existing user"""
deleteUser(input: deleteUserInput): deleteUserPayload
upload(refId: ID, ref: String, source: String, file: Upload!): UploadFile!
}
type MypluginTest {
id: ID!
type: String!
}
type Post {
id: ID!
created_at: DateTime!
updated_at: DateTime!
title: String
}
input PostInput {
title: String
}
type Query {
article(id: ID!): Articles
articles(sort: String, limit: Int, start: Int, where: JSON): [Articles]
post(id: ID!): Post
posts(sort: String, limit: Int, start: Int, where: JSON): [Post]
tag(id: ID!): Tag
tags(sort: String, limit: Int, start: Int, where: JSON): [Tag]
files(sort: String, limit: Int, start: Int, where: JSON): [UploadFile]
role(id: ID!): UsersPermissionsRole
"""
Retrieve all the existing roles. You can't apply filters on this query.
"""
roles(sort: String, limit: Int, start: Int, where: JSON): [UsersPermissionsRole]
user(id: ID!): UsersPermissionsUser
users(sort: String, limit: Int, start: Int, where: JSON): [UsersPermissionsUser]
test(id: ID!): MypluginTest
tests(sort: String, limit: Int, start: Int, where: JSON): [MypluginTest]
me: UsersPermissionsMe
userCustomRoute: String
}
input RoleInput {
name: String!
description: String
type: String
permissions: [ID]
users: [ID]
}
type Tag {
id: ID!
name: String
linkedArticles(sort: String, limit: Int, start: Int, where: JSON): [Articles]
}
input TagInput {
name: String
linkedArticles: [ID]
}
input TestInput {
type: String!
}
input updateArticlesInput {
where: InputID
data: editArticlesInput
}
type updateArticlesPayload {
article: Articles
}
input updatePostInput {
where: InputID
data: editPostInput
}
type updatePostPayload {
post: Post
}
input updateRoleInput {
where: InputID
data: editRoleInput
}
type updateRolePayload {
role: UsersPermissionsRole
}
input updateTagInput {
where: InputID
data: editTagInput
}
type updateTagPayload {
tag: Tag
}
input updateUserInput {
where: InputID
data: editUserInput
}
type updateUserPayload {
user: UsersPermissionsUser
}
"""The `Upload` scalar type represents a file upload."""
scalar Upload
type UploadFile {
id: ID!
created_at: DateTime!
updated_at: DateTime!
name: String!
hash: String!
sha256: String
ext: String
mime: String!
size: String!
url: String!
provider: String!
public_id: String
related(sort: String, limit: Int, start: Int, where: JSON): [Morph]
}
input UserInput {
username: String!
email: String!
provider: String
password: String
resetPasswordToken: String
confirmed: Boolean
blocked: Boolean
role: ID
}
type UsersPermissionsMe {
_id: ID!
username: String!
email: String!
confirmed: Boolean
blocked: Boolean
role: UsersPermissionsMeRole
}
type UsersPermissionsMeRole {
_id: ID!
name: String!
description: String
type: String
}
type UsersPermissionsPermission {
id: ID!
type: String!
controller: String!
action: String!
enabled: Boolean!
policy: String
role: UsersPermissionsRole
}
type UsersPermissionsRole {
id: ID!
name: String!
description: String
type: String
permissions(sort: String, limit: Int, start: Int, where: JSON): [UsersPermissionsPermission]
users(sort: String, limit: Int, start: Int, where: JSON): [UsersPermissionsUser]
}
type UsersPermissionsUser {
id: ID!
created_at: DateTime!
updated_at: DateTime!
username: String!
email: String!
provider: String
confirmed: Boolean
blocked: Boolean
role: UsersPermissionsRole
}

View File

@ -14,6 +14,7 @@
"lodash": "^4.17.5",
"pg": "^7.10.0",
"sqlite3": "^4.0.6",
"mysql": "^2.17.1",
"strapi": "3.0.0-beta.10",
"strapi-admin": "3.0.0-beta.10",
"strapi-hook-bookshelf": "3.0.0-beta.10",

View File

@ -77,8 +77,8 @@ module.exports = {
const parser = value => {
try {
const parsed = JSON.parse(value);
// do not modify initial value if it is string except 'null'
if (_.isObject(parsed) || _.isNull(parsed)) {
// if we parse a value and it is still a string leave it as is
if (typeof parsed !== 'string') {
value = parsed;
}
} catch (e) {
@ -140,7 +140,7 @@ module.exports = {
try {
const parsed = JSON.parse(value);
// do not modify initial value if it is string except 'null'
if (_.isObject(parsed) || _.isNull(parsed)) {
if (typeof parsed !== 'string') {
value = parsed;
}
} catch (e) {

View File

@ -3523,7 +3523,7 @@ big.js@^5.2.2:
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==
bignumber.js@^7.0.0:
bignumber.js@7.2.1, bignumber.js@^7.0.0:
version "7.2.1"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f"
integrity sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==
@ -11842,6 +11842,16 @@ mute-stream@~0.0.4:
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==
mysql@^2.17.1:
version "2.17.1"
resolved "https://registry.yarnpkg.com/mysql/-/mysql-2.17.1.tgz#62bba4a039a9b2f73638cd1652ce50fc6f682899"
integrity sha512-7vMqHQ673SAk5C8fOzTG2LpPcf3bNt0oL3sFpxPEEFp1mdlDcrLK0On7z8ZYKaaHrHwNcQ/MTUz7/oobZ2OyyA==
dependencies:
bignumber.js "7.2.1"
readable-stream "2.3.6"
safe-buffer "5.1.2"
sqlstring "2.3.1"
mz@^2.4.0, mz@^2.6.0, mz@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32"
@ -15012,7 +15022,7 @@ read@1, read@~1.0.1:
dependencies:
mute-stream "~0.0.4"
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6:
"readable-stream@1 || 2", readable-stream@2.3.6, readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6:
version "2.3.6"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf"
integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==
@ -16815,6 +16825,11 @@ sqlite3@^4.0.6:
node-pre-gyp "^0.11.0"
request "^2.87.0"
sqlstring@2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/sqlstring/-/sqlstring-2.3.1.tgz#475393ff9e91479aea62dcaf0ca3d14983a7fb40"
integrity sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A=
squeak@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/squeak/-/squeak-1.3.0.tgz#33045037b64388b567674b84322a6521073916c3"