feat: admin group edit / assign / unassign
This commit is contained in:
@@ -21,15 +21,20 @@
|
|||||||
v-text-field(label='Site Description', :counter='255', prepend-icon='public')
|
v-text-field(label='Site Description', :counter='255', prepend-icon='public')
|
||||||
v-text-field(label='Site Keywords', :counter='255', prepend-icon='public')
|
v-text-field(label='Site Keywords', :counter='255', prepend-icon='public')
|
||||||
v-select(label='Meta Robots', chips, tags, :items='metaRobots', v-model='metaRobotsSelection', prepend-icon='public')
|
v-select(label='Meta Robots', chips, tags, :items='metaRobots', v-model='metaRobotsSelection', prepend-icon='public')
|
||||||
v-divider
|
v-divider.my-0
|
||||||
.px-3.pb-3
|
v-card-actions.grey.lighten-4
|
||||||
v-btn(color='primary') Save
|
v-spacer
|
||||||
|
v-btn(color='primary')
|
||||||
|
v-icon(left) chevron_right
|
||||||
|
span Save
|
||||||
v-flex(lg6 xs12)
|
v-flex(lg6 xs12)
|
||||||
v-card
|
v-card
|
||||||
v-toolbar(color='primary', dark, dense, flat)
|
v-toolbar(color='primary', dark, dense, flat)
|
||||||
v-toolbar-title
|
v-toolbar-title
|
||||||
.subheading Site Branding
|
.subheading Site Branding
|
||||||
v-card-text ---
|
v-card-text
|
||||||
|
v-text-field(label='Logo', prepend-icon='image')
|
||||||
|
v-divider
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
v-card
|
v-card
|
||||||
v-card(flat, color='grey lighten-5').pa-3.pt-4
|
v-card(flat, color='grey lighten-5').pa-3.pt-4
|
||||||
.headline.blue--text.text--darken-2 Edit Group
|
.headline.blue--text.text--darken-2 Edit Group
|
||||||
.subheading.grey--text {{group.name}}
|
.subheading.grey--text {{name}}
|
||||||
v-btn(color='primary', fab, absolute, bottom, right, small, to='/groups'): v-icon arrow_upward
|
v-btn(color='primary', fab, absolute, bottom, right, small, to='/groups'): v-icon arrow_upward
|
||||||
v-tabs(v-model='tab', color='grey lighten-4', fixed-tabs, slider-color='primary', show-arrows)
|
v-tabs(v-model='tab', color='grey lighten-4', fixed-tabs, slider-color='primary', show-arrows)
|
||||||
v-tab(key='properties') Properties
|
v-tab(key='properties') Properties
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
v-tab-item(key='properties', :transition='false', :reverse-transition='false')
|
v-tab-item(key='properties', :transition='false', :reverse-transition='false')
|
||||||
v-card
|
v-card
|
||||||
v-card-text
|
v-card-text
|
||||||
v-text-field(v-model='group.name', label='Group Name', counter='255', prepend-icon='people')
|
v-text-field(v-model='name', label='Group Name', counter='255', prepend-icon='people')
|
||||||
v-card-actions.pa-3
|
v-card-actions.pa-3
|
||||||
v-btn(color='primary', @click='')
|
v-btn(color='primary', @click='updateGroup')
|
||||||
v-icon(left) check
|
v-icon(left) check
|
||||||
| Save Changes
|
| Save Changes
|
||||||
.caption.ml-4.grey--text ID: {{group.id}}
|
.caption.ml-4.grey--text ID: {{group.id}}
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
| Delete Group
|
| Delete Group
|
||||||
v-card
|
v-card
|
||||||
.dialog-header.is-red Delete Group?
|
.dialog-header.is-red Delete Group?
|
||||||
v-card-text Are you sure you want to delete group #[strong {{ group.name }}]? All users will be unassigned from this group.
|
v-card-text Are you sure you want to delete group #[strong {{ name }}]? All users will be unassigned from this group.
|
||||||
v-card-actions
|
v-card-actions
|
||||||
v-spacer
|
v-spacer
|
||||||
v-btn(flat, @click='deleteGroupDialog = false') Cancel
|
v-btn(flat, @click='deleteGroupDialog = false') Cancel
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
v-tab-item(key='users', :transition='false', :reverse-transition='false')
|
v-tab-item(key='users', :transition='false', :reverse-transition='false')
|
||||||
v-card
|
v-card
|
||||||
v-card-title.pb-0
|
v-card-title.pb-0
|
||||||
v-btn(color='primary', @click='assignUser')
|
v-btn(color='primary', @click='searchUserDialog = true')
|
||||||
v-icon(left) assignment_ind
|
v-icon(left) assignment_ind
|
||||||
| Assign User
|
| Assign User
|
||||||
v-data-table(
|
v-data-table(
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
v-menu(bottom, right, min-width='200')
|
v-menu(bottom, right, min-width='200')
|
||||||
v-btn(icon, slot='activator'): v-icon.grey--text.text--darken-1 more_horiz
|
v-btn(icon, slot='activator'): v-icon.grey--text.text--darken-1 more_horiz
|
||||||
v-list
|
v-list
|
||||||
v-list-tile(@click='deleteGroupConfirm(props.item)')
|
v-list-tile(@click='unassignUser(props.item.id)')
|
||||||
v-list-tile-action: v-icon(color='orange') highlight_off
|
v-list-tile-action: v-icon(color='orange') highlight_off
|
||||||
v-list-tile-content
|
v-list-tile-content
|
||||||
v-list-tile-title Unassign
|
v-list-tile-title Unassign
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
.text-xs-center.py-2(v-if='users.length > 15')
|
.text-xs-center.py-2(v-if='users.length > 15')
|
||||||
v-pagination(v-model='pagination.page', :length='pages')
|
v-pagination(v-model='pagination.page', :length='pages')
|
||||||
|
|
||||||
user-search(v-model='searchUserDialog')
|
user-search(v-model='searchUserDialog', @select='assignUser')
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -115,7 +115,10 @@ import Criterias from '../common/criterias.vue'
|
|||||||
import UserSearch from '../common/user-search.vue'
|
import UserSearch from '../common/user-search.vue'
|
||||||
|
|
||||||
import groupQuery from 'gql/admin-groups-query-single.gql'
|
import groupQuery from 'gql/admin-groups-query-single.gql'
|
||||||
|
import assignUserMutation from 'gql/admin-groups-mutation-assign.gql'
|
||||||
import deleteGroupMutation from 'gql/admin-groups-mutation-delete.gql'
|
import deleteGroupMutation from 'gql/admin-groups-mutation-delete.gql'
|
||||||
|
import unassignUserMutation from 'gql/admin-groups-mutation-unassign.gql'
|
||||||
|
import updateGroupMutation from 'gql/admin-groups-mutation-update.gql'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -125,10 +128,11 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
group: {
|
group: {
|
||||||
id: 7,
|
id: 0,
|
||||||
name: 'Editors',
|
name: '',
|
||||||
users: []
|
users: []
|
||||||
},
|
},
|
||||||
|
name: '',
|
||||||
deleteGroupDialog: false,
|
deleteGroupDialog: false,
|
||||||
searchUserDialog: false,
|
searchUserDialog: false,
|
||||||
pagination: {},
|
pagination: {},
|
||||||
@@ -152,10 +156,36 @@ export default {
|
|||||||
return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage)
|
return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
group(newValue, oldValue) {
|
||||||
|
this.name = newValue.name
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async deleteGroupConfirm(group) {
|
async updateGroup() {
|
||||||
this.deleteGroupDialog = true
|
try {
|
||||||
this.selectedGroup = group
|
await this.$apollo.mutate({
|
||||||
|
mutation: updateGroupMutation,
|
||||||
|
variables: {
|
||||||
|
id: this.group.id,
|
||||||
|
name: this.name
|
||||||
|
},
|
||||||
|
watchLoading (isLoading) {
|
||||||
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-groups-update')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$store.commit('showNotification', {
|
||||||
|
style: 'success',
|
||||||
|
message: `Group changes have been saved.`,
|
||||||
|
icon: 'check'
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
this.$store.commit('showNotification', {
|
||||||
|
style: 'red',
|
||||||
|
message: err.message,
|
||||||
|
icon: 'warning'
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async deleteGroup() {
|
async deleteGroup() {
|
||||||
this.deleteGroupDialog = false
|
this.deleteGroupDialog = false
|
||||||
@@ -183,8 +213,57 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
assignUser() {
|
async assignUser(id) {
|
||||||
this.searchUserDialog = true
|
try {
|
||||||
|
await this.$apollo.mutate({
|
||||||
|
mutation: assignUserMutation,
|
||||||
|
variables: {
|
||||||
|
groupId: this.group.id,
|
||||||
|
userId: id
|
||||||
|
},
|
||||||
|
watchLoading (isLoading) {
|
||||||
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-groups-assign')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$store.commit('showNotification', {
|
||||||
|
style: 'success',
|
||||||
|
message: `User has been assigned to ${this.group.name}.`,
|
||||||
|
icon: 'assignment_ind'
|
||||||
|
})
|
||||||
|
this.$apollo.queries.group.refetch()
|
||||||
|
} catch (err) {
|
||||||
|
this.$store.commit('showNotification', {
|
||||||
|
style: 'red',
|
||||||
|
message: err.message,
|
||||||
|
icon: 'warning'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async unassignUser(id) {
|
||||||
|
try {
|
||||||
|
await this.$apollo.mutate({
|
||||||
|
mutation: unassignUserMutation,
|
||||||
|
variables: {
|
||||||
|
groupId: this.group.id,
|
||||||
|
userId: id
|
||||||
|
},
|
||||||
|
watchLoading (isLoading) {
|
||||||
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-groups-unassign')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$store.commit('showNotification', {
|
||||||
|
style: 'success',
|
||||||
|
message: `User has been unassigned from ${this.group.name}.`,
|
||||||
|
icon: 'assignment_ind'
|
||||||
|
})
|
||||||
|
this.$apollo.queries.group.refetch()
|
||||||
|
} catch (err) {
|
||||||
|
this.$store.commit('showNotification', {
|
||||||
|
style: 'red',
|
||||||
|
message: err.message,
|
||||||
|
icon: 'warning'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
@@ -195,6 +274,7 @@ export default {
|
|||||||
id: this.$route.params.id
|
id: this.$route.params.id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
fetchPolicy: 'network-only',
|
||||||
update: (data) => data.groups.single,
|
update: (data) => data.groups.single,
|
||||||
watchLoading (isLoading) {
|
watchLoading (isLoading) {
|
||||||
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-groups-refresh')
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-groups-refresh')
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ export default {
|
|||||||
apollo: {
|
apollo: {
|
||||||
groups: {
|
groups: {
|
||||||
query: groupsQuery,
|
query: groupsQuery,
|
||||||
|
fetchPolicy: 'network-only',
|
||||||
update: (data) => data.groups.list,
|
update: (data) => data.groups.list,
|
||||||
watchLoading (isLoading) {
|
watchLoading (isLoading) {
|
||||||
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-groups-refresh')
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-groups-refresh')
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
v-layout(row wrap)
|
v-layout(row wrap)
|
||||||
v-flex(lg6 xs12)
|
v-flex(lg6 xs12)
|
||||||
v-card
|
v-card
|
||||||
v-toolbar(color='grey darken-3', dark, dense, flat)
|
v-toolbar(color='primary', dark, dense, flat)
|
||||||
v-toolbar-title
|
v-toolbar-title
|
||||||
.subheading Locale Settings
|
.subheading Locale Settings
|
||||||
v-card-text
|
v-card-text
|
||||||
@@ -38,8 +38,9 @@
|
|||||||
persistent-hint
|
persistent-hint
|
||||||
hint='Automatically download updates to this locale as they become available.'
|
hint='Automatically download updates to this locale as they become available.'
|
||||||
)
|
)
|
||||||
v-divider
|
v-divider.my-0
|
||||||
.px-3.pb-3
|
v-card-actions.grey.lighten-4
|
||||||
|
v-spacer
|
||||||
v-btn(color='primary', :loading='loading', @click='save')
|
v-btn(color='primary', :loading='loading', @click='save')
|
||||||
v-icon(left) chevron_right
|
v-icon(left) chevron_right
|
||||||
span Save
|
span Save
|
||||||
@@ -49,7 +50,7 @@
|
|||||||
v-toolbar-title
|
v-toolbar-title
|
||||||
.subheading Download Locale
|
.subheading Download Locale
|
||||||
v-list
|
v-list
|
||||||
v-list-tile(v-for='lc in locales')
|
v-list-tile(v-for='lc in locales', :key='lc.code')
|
||||||
v-list-tile-avatar
|
v-list-tile-avatar
|
||||||
v-avatar.teal.white--text(tile, size='40') {{lc.code.toUpperCase()}}
|
v-avatar.teal.white--text(tile, size='40') {{lc.code.toUpperCase()}}
|
||||||
v-list-tile-content
|
v-list-tile-content
|
||||||
@@ -159,7 +160,3 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss'>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
v-layout(row wrap)
|
v-layout(row wrap)
|
||||||
v-flex(lg6 xs12)
|
v-flex(lg6 xs12)
|
||||||
v-card
|
v-card
|
||||||
v-toolbar(color='grey darken-3', dark, dense, flat)
|
v-toolbar(color='primary', dark, dense, flat)
|
||||||
v-toolbar-title
|
v-toolbar-title
|
||||||
.subheading Theme
|
.subheading Theme
|
||||||
v-card-text
|
v-card-text
|
||||||
@@ -21,9 +21,12 @@
|
|||||||
v-list-tile-sub-title(v-html='data.item.author')
|
v-list-tile-sub-title(v-html='data.item.author')
|
||||||
v-divider
|
v-divider
|
||||||
v-switch(v-model='darkMode', label='Dark Mode', color='primary', persistent-hint, hint='Not recommended for accessibility.')
|
v-switch(v-model='darkMode', label='Dark Mode', color='primary', persistent-hint, hint='Not recommended for accessibility.')
|
||||||
v-divider
|
v-divider.my-0
|
||||||
.px-3.pb-3
|
v-card-actions.grey.lighten-4
|
||||||
v-btn(color='primary') Save
|
v-spacer
|
||||||
|
v-btn(color='primary', :loading='loading', @click='save')
|
||||||
|
v-icon(left) chevron_right
|
||||||
|
span Save
|
||||||
v-flex(lg6 xs12)
|
v-flex(lg6 xs12)
|
||||||
v-card
|
v-card
|
||||||
v-toolbar(color='teal', dark, dense, flat)
|
v-toolbar(color='teal', dark, dense, flat)
|
||||||
|
|||||||
@@ -1,38 +1,66 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
v-dialog(v-model='dialogOpen', max-width='650')
|
v-dialog(
|
||||||
|
v-model='dialogOpen'
|
||||||
|
max-width='650'
|
||||||
|
)
|
||||||
v-card
|
v-card
|
||||||
.dialog-header Search User
|
.dialog-header
|
||||||
v-card-text
|
span Search User
|
||||||
v-select(
|
|
||||||
:items='items'
|
|
||||||
:loading='searchLoading'
|
|
||||||
:search-input.sync='search'
|
|
||||||
autocomplete
|
|
||||||
autofocus
|
|
||||||
cache-items
|
|
||||||
chips
|
|
||||||
clearable
|
|
||||||
hide-details
|
|
||||||
item-text='name',
|
|
||||||
item-value='id',
|
|
||||||
label='Search users...'
|
|
||||||
light
|
|
||||||
multiple
|
|
||||||
v-model='selectedItems'
|
|
||||||
)
|
|
||||||
v-card-actions
|
|
||||||
v-spacer
|
v-spacer
|
||||||
v-btn(flat, @click='close', :disabled='loading') Cancel
|
v-progress-circular(
|
||||||
v-btn(color='primary', dark, @click='setUser', :loading='loading', :disabled='loading')
|
indeterminate
|
||||||
v-icon(left) assignment_ind
|
color='white'
|
||||||
span Select User
|
:size='20'
|
||||||
|
:width='2'
|
||||||
|
v-show='searchLoading'
|
||||||
|
)
|
||||||
|
v-card-text
|
||||||
|
v-text-field.blue.lighten-5(
|
||||||
|
solo
|
||||||
|
flat
|
||||||
|
label='Search Users...'
|
||||||
|
v-model='search'
|
||||||
|
prepend-icon='search'
|
||||||
|
color='primary'
|
||||||
|
ref='searchIpt'
|
||||||
|
)
|
||||||
|
v-list(two-line)
|
||||||
|
template(v-for='(usr, idx) in items')
|
||||||
|
v-list-tile(:key='usr.id', @click='setUser(usr.id)')
|
||||||
|
v-list-tile-avatar(size='40', color='primary')
|
||||||
|
span.body-1.white--text {{usr.name | initials}}
|
||||||
|
v-list-tile-content
|
||||||
|
v-list-tile-title {{usr.name}}
|
||||||
|
v-list-tile-sub-title {{usr.email}}
|
||||||
|
v-list-tile-action
|
||||||
|
v-icon(color='primary') arrow_forward
|
||||||
|
v-divider.my-0(v-if='idx < items.length - 1')
|
||||||
|
v-divider.my-0
|
||||||
|
v-card-actions.grey.lighten-4
|
||||||
|
v-spacer
|
||||||
|
v-btn(
|
||||||
|
flat
|
||||||
|
@click='close'
|
||||||
|
:disabled='loading'
|
||||||
|
) Cancel
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
import searchUsersQuery from 'gql/common-users-query-search.gql'
|
import searchUsersQuery from 'gql/common-users-query-search.gql'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
filters: {
|
||||||
|
initials(val) {
|
||||||
|
return val.split(' ').map(v => v.substring(0, 1)).join()
|
||||||
|
}
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
|
multiple: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
value: {
|
value: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@@ -43,8 +71,7 @@ export default {
|
|||||||
loading: false,
|
loading: false,
|
||||||
searchLoading: false,
|
searchLoading: false,
|
||||||
search: '',
|
search: '',
|
||||||
items: [],
|
items: []
|
||||||
selectedItems: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -53,12 +80,25 @@ export default {
|
|||||||
set(value) { this.$emit('input', value) }
|
set(value) { this.$emit('input', value) }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
value(newValue, oldValue) {
|
||||||
|
if (newValue && !oldValue) {
|
||||||
|
this.search = ''
|
||||||
|
this.selectedItems = null
|
||||||
|
_.delay(() => { this.$refs.searchIpt.focus() }, 100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
close() {
|
close() {
|
||||||
this.$emit('input', false)
|
this.$emit('input', false)
|
||||||
},
|
},
|
||||||
setUser() {
|
setUser(id) {
|
||||||
|
this.$emit('select', id)
|
||||||
|
this.close()
|
||||||
|
},
|
||||||
|
searchFilter(item, queryText, itemText) {
|
||||||
|
return _.includes(_.toLower(item.email), _.toLower(queryText)) || _.includes(_.toLower(item.name), _.toLower(queryText))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
@@ -66,13 +106,13 @@ export default {
|
|||||||
query: searchUsersQuery,
|
query: searchUsersQuery,
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
search: this.search
|
query: this.search
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
skip() {
|
skip() {
|
||||||
return !this.search || this.search.length < 2
|
return !this.search || this.search.length < 2
|
||||||
},
|
},
|
||||||
update: (data) => data.upsells.segments,
|
update: (data) => data.users.search,
|
||||||
watchLoading (isLoading) {
|
watchLoading (isLoading) {
|
||||||
this.searchLoading = isLoading
|
this.searchLoading = isLoading
|
||||||
}
|
}
|
||||||
|
|||||||
12
client/graph/admin-groups-mutation-assign.gql
Normal file
12
client/graph/admin-groups-mutation-assign.gql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
mutation ($groupId: Int!, $userId: Int!) {
|
||||||
|
groups {
|
||||||
|
assignUser(groupId: $groupId, userId: $userId) {
|
||||||
|
responseResult {
|
||||||
|
succeeded
|
||||||
|
errorCode
|
||||||
|
slug
|
||||||
|
message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
client/graph/admin-groups-mutation-unassign.gql
Normal file
12
client/graph/admin-groups-mutation-unassign.gql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
mutation ($groupId: Int!, $userId: Int!) {
|
||||||
|
groups {
|
||||||
|
unassignUser(groupId: $groupId, userId: $userId) {
|
||||||
|
responseResult {
|
||||||
|
succeeded
|
||||||
|
errorCode
|
||||||
|
slug
|
||||||
|
message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
client/graph/admin-groups-mutation-update.gql
Normal file
12
client/graph/admin-groups-mutation-update.gql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
mutation ($id: Int!, $name: String!) {
|
||||||
|
groups {
|
||||||
|
update(id: $id, name: $name) {
|
||||||
|
responseResult {
|
||||||
|
succeeded
|
||||||
|
errorCode
|
||||||
|
slug
|
||||||
|
message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ query ($query: String!) {
|
|||||||
id
|
id
|
||||||
name
|
name
|
||||||
email
|
email
|
||||||
|
provider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
48
package.json
48
package.json
@@ -61,15 +61,15 @@
|
|||||||
"express-brute": "1.0.1",
|
"express-brute": "1.0.1",
|
||||||
"express-brute-redis": "0.0.1",
|
"express-brute-redis": "0.0.1",
|
||||||
"express-session": "1.15.6",
|
"express-session": "1.15.6",
|
||||||
"file-type": "7.6.0",
|
"file-type": "7.7.1",
|
||||||
"filesize.js": "1.0.2",
|
"filesize.js": "1.0.2",
|
||||||
"follow-redirects": "1.4.1",
|
"follow-redirects": "1.4.1",
|
||||||
"fs-extra": "5.0.0",
|
"fs-extra": "6.0.1",
|
||||||
"getos": "3.1.0",
|
"getos": "3.1.0",
|
||||||
"graphql": "0.13.2",
|
"graphql": "0.13.2",
|
||||||
"graphql-list-fields": "2.0.2",
|
"graphql-list-fields": "2.0.2",
|
||||||
"graphql-tools": "3.0.0",
|
"graphql-tools": "3.0.1",
|
||||||
"i18next": "11.2.3",
|
"i18next": "11.3.1",
|
||||||
"i18next-express-middleware": "1.1.1",
|
"i18next-express-middleware": "1.1.1",
|
||||||
"i18next-localstorage-cache": "1.1.1",
|
"i18next-localstorage-cache": "1.1.1",
|
||||||
"i18next-node-fs-backend": "1.0.0",
|
"i18next-node-fs-backend": "1.0.0",
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
"markdown-it": "8.4.1",
|
"markdown-it": "8.4.1",
|
||||||
"markdown-it-abbr": "1.0.4",
|
"markdown-it-abbr": "1.0.4",
|
||||||
"markdown-it-anchor": "4.0.0",
|
"markdown-it-anchor": "4.0.0",
|
||||||
"markdown-it-attrs": "1.2.1",
|
"markdown-it-attrs": "2.0.0",
|
||||||
"markdown-it-emoji": "1.4.0",
|
"markdown-it-emoji": "1.4.0",
|
||||||
"markdown-it-expand-tabs": "1.0.13",
|
"markdown-it-expand-tabs": "1.0.13",
|
||||||
"markdown-it-external-links": "0.0.6",
|
"markdown-it-external-links": "0.0.6",
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
"mysql2": "1.5.3",
|
"mysql2": "1.5.3",
|
||||||
"node-2fa": "1.1.2",
|
"node-2fa": "1.1.2",
|
||||||
"oauth2orize": "1.11.0",
|
"oauth2orize": "1.11.0",
|
||||||
"ora": "2.0.0",
|
"ora": "2.1.0",
|
||||||
"passport": "0.4.0",
|
"passport": "0.4.0",
|
||||||
"passport-auth0": "0.6.1",
|
"passport-auth0": "0.6.1",
|
||||||
"passport-azure-ad-oauth2": "0.0.4",
|
"passport-azure-ad-oauth2": "0.0.4",
|
||||||
@@ -123,45 +123,45 @@
|
|||||||
"pm2": "2.10.3",
|
"pm2": "2.10.3",
|
||||||
"pug": "2.0.3",
|
"pug": "2.0.3",
|
||||||
"qr-image": "3.2.0",
|
"qr-image": "3.2.0",
|
||||||
"raven": "2.6.0",
|
"raven": "2.6.1",
|
||||||
"read-chunk": "2.1.0",
|
"read-chunk": "2.1.0",
|
||||||
"remove-markdown": "0.2.2",
|
"remove-markdown": "0.2.2",
|
||||||
"request": "2.85.0",
|
"request": "2.85.0",
|
||||||
"request-promise": "4.2.2",
|
"request-promise": "4.2.2",
|
||||||
"scim-query-filter-parser": "1.1.0",
|
"scim-query-filter-parser": "1.1.0",
|
||||||
"semver": "5.5.0",
|
"semver": "5.5.0",
|
||||||
"sequelize": "4.37.6",
|
"sequelize": "4.37.7",
|
||||||
"serve-favicon": "2.5.0",
|
"serve-favicon": "2.5.0",
|
||||||
"sqlite3": "4.0.0",
|
"sqlite3": "4.0.0",
|
||||||
"uuid": "3.2.1",
|
"uuid": "3.2.1",
|
||||||
"validator": "9.4.1",
|
"validator": "10.2.0",
|
||||||
"validator-as-promised": "1.0.2",
|
"validator-as-promised": "1.0.2",
|
||||||
"winston": "3.0.0-rc2",
|
"winston": "3.0.0-rc2",
|
||||||
"yargs": "11.0.0"
|
"yargs": "11.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@panter/vue-i18next": "0.9.1",
|
"@panter/vue-i18next": "0.9.1",
|
||||||
"@vue/cli": "3.0.0-beta.9",
|
"@vue/cli": "3.0.0-beta.10",
|
||||||
"apollo-client-preset": "1.0.8",
|
"apollo-client-preset": "1.0.8",
|
||||||
"apollo-fetch": "0.7.0",
|
"apollo-fetch": "0.7.0",
|
||||||
"apollo-link-batch-http": "1.2.2",
|
"apollo-link-batch-http": "1.2.2",
|
||||||
"autoprefixer": "8.3.0",
|
"autoprefixer": "8.4.1",
|
||||||
"babel-cli": "6.26.0",
|
"babel-cli": "6.26.0",
|
||||||
"babel-core": "6.26.3",
|
"babel-core": "6.26.3",
|
||||||
"babel-eslint": "8.2.3",
|
"babel-eslint": "8.2.3",
|
||||||
"babel-jest": "23.0.0-alpha.0",
|
"babel-jest": "23.0.0-alpha.0",
|
||||||
"babel-loader": "7.1.4",
|
"babel-loader": "7.1.4",
|
||||||
"babel-plugin-graphql-tag": "1.5.0",
|
"babel-plugin-graphql-tag": "1.6.0",
|
||||||
"babel-plugin-lodash": "3.3.2",
|
"babel-plugin-lodash": "3.3.2",
|
||||||
"babel-plugin-transform-imports": "1.5.0",
|
"babel-plugin-transform-imports": "1.5.0",
|
||||||
"babel-polyfill": "6.26.0",
|
"babel-polyfill": "6.26.0",
|
||||||
"babel-preset-env": "1.6.1",
|
"babel-preset-env": "1.7.0",
|
||||||
"babel-preset-es2015": "6.24.1",
|
"babel-preset-es2015": "6.24.1",
|
||||||
"babel-preset-stage-2": "6.24.1",
|
"babel-preset-stage-2": "6.24.1",
|
||||||
"brace": "0.11.1",
|
"brace": "0.11.1",
|
||||||
"cache-loader": "1.2.2",
|
"cache-loader": "1.2.2",
|
||||||
"clean-webpack-plugin": "0.1.19",
|
"clean-webpack-plugin": "0.1.19",
|
||||||
"colors": "1.2.1",
|
"colors": "1.2.5",
|
||||||
"copy-webpack-plugin": "4.5.1",
|
"copy-webpack-plugin": "4.5.1",
|
||||||
"css-loader": "0.28.11",
|
"css-loader": "0.28.11",
|
||||||
"cssnano": "4.0.0-rc.2",
|
"cssnano": "4.0.0-rc.2",
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
"eslint-plugin-vue": "4.5.0",
|
"eslint-plugin-vue": "4.5.0",
|
||||||
"file-loader": "1.1.11",
|
"file-loader": "1.1.11",
|
||||||
"graphiql": "0.11.11",
|
"graphiql": "0.11.11",
|
||||||
"graphql-tag": "^2.9.1",
|
"graphql-tag": "^2.9.2",
|
||||||
"graphql-voyager": "1.0.0-rc.15",
|
"graphql-voyager": "1.0.0-rc.15",
|
||||||
"hammerjs": "2.0.8",
|
"hammerjs": "2.0.8",
|
||||||
"html-webpack-plugin": "3.2.0",
|
"html-webpack-plugin": "3.2.0",
|
||||||
@@ -189,13 +189,13 @@
|
|||||||
"lodash-webpack-plugin": "0.11.5",
|
"lodash-webpack-plugin": "0.11.5",
|
||||||
"mini-css-extract-plugin": "0.4.0",
|
"mini-css-extract-plugin": "0.4.0",
|
||||||
"node-sass": "4.9.0",
|
"node-sass": "4.9.0",
|
||||||
"offline-plugin": "5.0.1",
|
"offline-plugin": "5.0.3",
|
||||||
"optimize-css-assets-webpack-plugin": "4.0.0",
|
"optimize-css-assets-webpack-plugin": "4.0.1",
|
||||||
"postcss-cssnext": "3.1.0",
|
"postcss-cssnext": "3.1.0",
|
||||||
"postcss-flexbugs-fixes": "3.3.0",
|
"postcss-flexbugs-fixes": "3.3.1",
|
||||||
"postcss-flexibility": "2.0.0",
|
"postcss-flexibility": "2.0.0",
|
||||||
"postcss-import": "11.1.0",
|
"postcss-import": "11.1.0",
|
||||||
"postcss-loader": "2.1.4",
|
"postcss-loader": "2.1.5",
|
||||||
"postcss-selector-parser": "4.0.0",
|
"postcss-selector-parser": "4.0.0",
|
||||||
"pug-lint": "2.5.0",
|
"pug-lint": "2.5.0",
|
||||||
"pug-loader": "2.4.0",
|
"pug-loader": "2.4.0",
|
||||||
@@ -211,14 +211,14 @@
|
|||||||
"stylus": "0.54.5",
|
"stylus": "0.54.5",
|
||||||
"stylus-loader": "3.0.2",
|
"stylus-loader": "3.0.2",
|
||||||
"twemoji-awesome": "1.0.6",
|
"twemoji-awesome": "1.0.6",
|
||||||
"vee-validate": "2.0.8",
|
"vee-validate": "2.0.9",
|
||||||
"velocity-animate": "1.5.1",
|
"velocity-animate": "1.5.1",
|
||||||
"vue": "2.5.16",
|
"vue": "2.5.16",
|
||||||
"vue-apollo": "3.0.0-beta.5",
|
"vue-apollo": "3.0.0-beta.5",
|
||||||
"vue-clipboards": "1.2.4",
|
"vue-clipboards": "1.2.4",
|
||||||
"vue-codemirror": "4.0.5",
|
"vue-codemirror": "4.0.5",
|
||||||
"vue-hot-reload-api": "2.3.0",
|
"vue-hot-reload-api": "2.3.0",
|
||||||
"vue-loader": "15.0.4",
|
"vue-loader": "15.0.10",
|
||||||
"vue-material-design-icons": "1.4.0",
|
"vue-material-design-icons": "1.4.0",
|
||||||
"vue-moment": "3.2.0",
|
"vue-moment": "3.2.0",
|
||||||
"vue-router": "3.0.1",
|
"vue-router": "3.0.1",
|
||||||
@@ -227,9 +227,9 @@
|
|||||||
"vuetify": "1.0.17",
|
"vuetify": "1.0.17",
|
||||||
"vuex": "3.0.1",
|
"vuex": "3.0.1",
|
||||||
"vuex-persistedstate": "2.5.2",
|
"vuex-persistedstate": "2.5.2",
|
||||||
"webpack": "4.6.0",
|
"webpack": "4.8.2",
|
||||||
"webpack-bundle-analyzer": "2.11.1",
|
"webpack-bundle-analyzer": "2.11.2",
|
||||||
"webpack-cli": "2.0.15",
|
"webpack-cli": "2.1.3",
|
||||||
"webpack-dev-middleware": "3.1.3",
|
"webpack-dev-middleware": "3.1.3",
|
||||||
"webpack-hot-middleware": "2.22.1",
|
"webpack-hot-middleware": "2.22.1",
|
||||||
"webpack-merge": "4.1.2",
|
"webpack-merge": "4.1.2",
|
||||||
|
|||||||
@@ -34,18 +34,19 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
GroupMutation: {
|
GroupMutation: {
|
||||||
assignUser(obj, args) {
|
async assignUser(obj, args) {
|
||||||
return WIKI.db.Group.findById(args.groupId).then(grp => {
|
const grp = await WIKI.db.Group.findById(args.groupId)
|
||||||
if (!grp) {
|
if (!grp) {
|
||||||
throw new gql.GraphQLError('Invalid Group ID')
|
throw new gql.GraphQLError('Invalid Group ID')
|
||||||
}
|
}
|
||||||
return WIKI.db.User.findById(args.userId).then(usr => {
|
const usr = await WIKI.db.User.findById(args.userId)
|
||||||
if (!usr) {
|
if (!usr) {
|
||||||
throw new gql.GraphQLError('Invalid User ID')
|
throw new gql.GraphQLError('Invalid User ID')
|
||||||
}
|
}
|
||||||
return grp.addUser(usr)
|
await grp.addUser(usr)
|
||||||
})
|
return {
|
||||||
})
|
responseResult: graphHelper.generateSuccess('User has been assigned to group.')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async create(obj, args) {
|
async create(obj, args) {
|
||||||
const group = await WIKI.db.Group.create({
|
const group = await WIKI.db.Group.create({
|
||||||
@@ -67,25 +68,29 @@ module.exports = {
|
|||||||
responseResult: graphHelper.generateSuccess('Group has been deleted.')
|
responseResult: graphHelper.generateSuccess('Group has been deleted.')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unassignUser(obj, args) {
|
async unassignUser(obj, args) {
|
||||||
return WIKI.db.Group.findById(args.groupId).then(grp => {
|
const grp = await WIKI.db.Group.findById(args.groupId)
|
||||||
if (!grp) {
|
if (!grp) {
|
||||||
throw new gql.GraphQLError('Invalid Group ID')
|
throw new gql.GraphQLError('Invalid Group ID')
|
||||||
}
|
}
|
||||||
return WIKI.db.User.findById(args.userId).then(usr => {
|
const usr = await WIKI.db.User.findById(args.userId)
|
||||||
if (!usr) {
|
if (!usr) {
|
||||||
throw new gql.GraphQLError('Invalid User ID')
|
throw new gql.GraphQLError('Invalid User ID')
|
||||||
}
|
}
|
||||||
return grp.removeUser(usr)
|
await grp.removeUser(usr)
|
||||||
})
|
return {
|
||||||
})
|
responseResult: graphHelper.generateSuccess('User has been unassigned from group.')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
update(obj, args) {
|
async update(obj, args) {
|
||||||
return WIKI.db.Group.update({
|
await WIKI.db.Group.update({
|
||||||
name: args.name
|
name: args.name
|
||||||
}, {
|
}, {
|
||||||
where: { id: args.id }
|
where: { id: args.id }
|
||||||
})
|
})
|
||||||
|
return {
|
||||||
|
responseResult: graphHelper.generateSuccess('Group has been updated.')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Group: {
|
Group: {
|
||||||
|
|||||||
@@ -3,15 +3,42 @@
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Query: {
|
Query: {
|
||||||
users(obj, args, context, info) {
|
async users() { return {} }
|
||||||
return WIKI.db.User.findAll({ where: args })
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
Mutation: {
|
Mutation: {
|
||||||
createUser(obj, args) {
|
async users() { return {} }
|
||||||
|
},
|
||||||
|
UserQuery: {
|
||||||
|
async list(obj, args, context, info) {
|
||||||
|
return WIKI.db.User.findAll({
|
||||||
|
attributes: {
|
||||||
|
exclude: ['password', 'tfaSecret']
|
||||||
|
},
|
||||||
|
raw: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async search(obj, args, context, info) {
|
||||||
|
return WIKI.db.User.findAll({
|
||||||
|
where: {
|
||||||
|
$or: [
|
||||||
|
{ email: { $like: `%${args.query}%` } },
|
||||||
|
{ name: { $like: `%${args.query}%` } }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
limit: 10,
|
||||||
|
attributes: ['id', 'email', 'name', 'provider', 'role', 'createdAt', 'updatedAt'],
|
||||||
|
raw: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async single(obj, args, context, info) {
|
||||||
|
return WIKI.db.User.findById(args.id)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
UserMutation: {
|
||||||
|
create(obj, args) {
|
||||||
return WIKI.db.User.create(args)
|
return WIKI.db.User.create(args)
|
||||||
},
|
},
|
||||||
deleteUser(obj, args) {
|
delete(obj, args) {
|
||||||
return WIKI.db.User.destroy({
|
return WIKI.db.User.destroy({
|
||||||
where: {
|
where: {
|
||||||
id: args.id
|
id: args.id
|
||||||
@@ -19,7 +46,7 @@ module.exports = {
|
|||||||
limit: 1
|
limit: 1
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
modifyUser(obj, args) {
|
update(obj, args) {
|
||||||
return WIKI.db.User.update({
|
return WIKI.db.User.update({
|
||||||
email: args.email,
|
email: args.email,
|
||||||
name: args.name,
|
name: args.name,
|
||||||
@@ -30,10 +57,10 @@ module.exports = {
|
|||||||
where: { id: args.id }
|
where: { id: args.id }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
resetUserPassword(obj, args) {
|
resetPassword(obj, args) {
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
setUserPassword(obj, args) {
|
setPassword(obj, args) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,12 +2,6 @@
|
|||||||
|
|
||||||
# ENUMS
|
# ENUMS
|
||||||
|
|
||||||
enum UserRole {
|
|
||||||
guest
|
|
||||||
user
|
|
||||||
admin
|
|
||||||
}
|
|
||||||
|
|
||||||
enum FileType {
|
enum FileType {
|
||||||
binary
|
binary
|
||||||
image
|
image
|
||||||
@@ -134,19 +128,6 @@ type Translation {
|
|||||||
value: String!
|
value: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
# A User
|
|
||||||
type User implements Base {
|
|
||||||
id: Int!
|
|
||||||
createdAt: Date
|
|
||||||
updatedAt: Date
|
|
||||||
email: String!
|
|
||||||
provider: String!
|
|
||||||
providerId: String
|
|
||||||
name: String
|
|
||||||
role: UserRole!
|
|
||||||
groups: [Group]
|
|
||||||
}
|
|
||||||
|
|
||||||
type OperationResult {
|
type OperationResult {
|
||||||
succeeded: Boolean!
|
succeeded: Boolean!
|
||||||
message: String
|
message: String
|
||||||
@@ -164,7 +145,6 @@ type Query {
|
|||||||
settings(key: String): [Setting]
|
settings(key: String): [Setting]
|
||||||
tags(key: String): [Tag]
|
tags(key: String): [Tag]
|
||||||
translations(locale: String!, namespace: String!): [Translation]
|
translations(locale: String!, namespace: String!): [Translation]
|
||||||
users(id: Int, email: String, provider: String, providerId: String, role: UserRole): [User]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mutations (Create, Update, Delete)
|
# Mutations (Create, Update, Delete)
|
||||||
@@ -202,15 +182,6 @@ type Mutation {
|
|||||||
name: String!
|
name: String!
|
||||||
): Tag
|
): Tag
|
||||||
|
|
||||||
createUser(
|
|
||||||
email: String!
|
|
||||||
name: String
|
|
||||||
passwordRaw: String
|
|
||||||
provider: String!
|
|
||||||
providerId: String
|
|
||||||
role: UserRole!
|
|
||||||
): User
|
|
||||||
|
|
||||||
deleteComment(
|
deleteComment(
|
||||||
id: Int!
|
id: Int!
|
||||||
): OperationResult
|
): OperationResult
|
||||||
@@ -231,10 +202,6 @@ type Mutation {
|
|||||||
id: Int!
|
id: Int!
|
||||||
): OperationResult
|
): OperationResult
|
||||||
|
|
||||||
deleteUser(
|
|
||||||
id: Int!
|
|
||||||
): OperationResult
|
|
||||||
|
|
||||||
modifyComment(
|
modifyComment(
|
||||||
id: Int!
|
id: Int!
|
||||||
content: String!
|
content: String!
|
||||||
@@ -246,15 +213,6 @@ type Mutation {
|
|||||||
subtitle: String
|
subtitle: String
|
||||||
): Document
|
): Document
|
||||||
|
|
||||||
modifyUser(
|
|
||||||
id: Int!
|
|
||||||
email: String
|
|
||||||
name: String
|
|
||||||
provider: String
|
|
||||||
providerId: String
|
|
||||||
role: UserRole
|
|
||||||
): User
|
|
||||||
|
|
||||||
modifyRight(
|
modifyRight(
|
||||||
id: Int!
|
id: Int!
|
||||||
path: String
|
path: String
|
||||||
@@ -297,20 +255,11 @@ type Mutation {
|
|||||||
rightId: Int!
|
rightId: Int!
|
||||||
): OperationResult
|
): OperationResult
|
||||||
|
|
||||||
resetUserPassword(
|
|
||||||
id: Int!
|
|
||||||
): OperationResult
|
|
||||||
|
|
||||||
setConfigEntry(
|
setConfigEntry(
|
||||||
key: String!
|
key: String!
|
||||||
value: String!
|
value: String!
|
||||||
): OperationResult
|
): OperationResult
|
||||||
|
|
||||||
setUserPassword(
|
|
||||||
id: Int!
|
|
||||||
passwordRaw: String!
|
|
||||||
): OperationResult
|
|
||||||
|
|
||||||
uploadFile(
|
uploadFile(
|
||||||
category: FileType!
|
category: FileType!
|
||||||
filename: String!
|
filename: String!
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ type GroupMutation {
|
|||||||
update(
|
update(
|
||||||
id: Int!
|
id: Int!
|
||||||
name: String!
|
name: String!
|
||||||
): GroupResponse
|
): DefaultResponse
|
||||||
|
|
||||||
delete(
|
delete(
|
||||||
id: Int!
|
id: Int!
|
||||||
|
|||||||
101
server/graph/schemas/user.graphql
Normal file
101
server/graph/schemas/user.graphql
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
# ===============================================
|
||||||
|
# USERS
|
||||||
|
# ===============================================
|
||||||
|
|
||||||
|
extend type Query {
|
||||||
|
users: UserQuery
|
||||||
|
}
|
||||||
|
|
||||||
|
extend type Mutation {
|
||||||
|
users: UserMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------
|
||||||
|
# QUERIES
|
||||||
|
# -----------------------------------------------
|
||||||
|
|
||||||
|
type UserQuery {
|
||||||
|
list(
|
||||||
|
filter: String
|
||||||
|
orderBy: String
|
||||||
|
): [UserMinimal]
|
||||||
|
|
||||||
|
search(
|
||||||
|
query: String!
|
||||||
|
): [UserMinimal]
|
||||||
|
|
||||||
|
single(
|
||||||
|
id: Int!
|
||||||
|
): User
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------
|
||||||
|
# MUTATIONS
|
||||||
|
# -----------------------------------------------
|
||||||
|
|
||||||
|
type UserMutation {
|
||||||
|
create(
|
||||||
|
email: String!
|
||||||
|
name: String
|
||||||
|
passwordRaw: String
|
||||||
|
provider: String!
|
||||||
|
providerId: String
|
||||||
|
role: UserRole!
|
||||||
|
): UserResponse
|
||||||
|
|
||||||
|
update(
|
||||||
|
id: Int!
|
||||||
|
email: String
|
||||||
|
name: String
|
||||||
|
provider: String
|
||||||
|
providerId: String
|
||||||
|
role: UserRole
|
||||||
|
): UserResponse
|
||||||
|
|
||||||
|
delete(
|
||||||
|
id: Int!
|
||||||
|
): DefaultResponse
|
||||||
|
|
||||||
|
resetPassword(
|
||||||
|
id: Int!
|
||||||
|
): DefaultResponse
|
||||||
|
|
||||||
|
setPassword(
|
||||||
|
id: Int!
|
||||||
|
passwordRaw: String!
|
||||||
|
): DefaultResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------
|
||||||
|
# TYPES
|
||||||
|
# -----------------------------------------------
|
||||||
|
|
||||||
|
enum UserRole {
|
||||||
|
guest
|
||||||
|
user
|
||||||
|
admin
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserResponse {
|
||||||
|
responseResult: ResponseStatus!
|
||||||
|
user: User
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserMinimal {
|
||||||
|
id: Int!
|
||||||
|
name: String!
|
||||||
|
email: String!
|
||||||
|
provider: String!
|
||||||
|
}
|
||||||
|
|
||||||
|
type User {
|
||||||
|
id: Int!
|
||||||
|
name: String!
|
||||||
|
email: String!
|
||||||
|
provider: String!
|
||||||
|
providerId: String
|
||||||
|
role: UserRole!
|
||||||
|
createdAt: Date!
|
||||||
|
updatedAt: Date!
|
||||||
|
groups: [Group]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user