Compare commits

...

4 commits

Author SHA1 Message Date
Aran Zaiger 8931f4bd86 - Adding adonis testing infrastracture
- example test and simple delete usr test added
- extract delete user logics from controller
2020-05-31 16:46:03 +03:00
Aran Zaiger d883640955 add edit user button 2020-05-26 15:39:24 +03:00
Aran Zaiger a73ec272a8 del user-del also children & links of children 2020-05-26 14:52:36 +03:00
Aran Zaiger 3bfa60db28 Adding Delete user button and basic functionality 2020-05-23 22:02:04 +03:00
19 changed files with 8263 additions and 724 deletions

33
TODO Normal file
View file

@ -0,0 +1,33 @@
- Testing
- create tests infrastracture
- Tests
- create user
- delete user
- create&delete user with children
- create&delete user with connections
- Admin view
- Bugs
- delete children and links
- delete user
V delete self
V delete child
V delete self
V delete links
V delete links vvv
- delete books and pages
- delete user in 2 different windows (check if global 'currentUser' is affected)
- Edit user
- edit users fields
- Grapsh
- general
- change period option (year,month,week,day)
- sections (Users, calls, books? children?)
- users
- Last created
- Last logged in
- calls
- avarage duration (need to add duration to table)
- active calls?

View file

@ -5,36 +5,47 @@ const Link = use('App/Models/Link');
const IceServer = use('App/Models/IceServer'); const IceServer = use('App/Models/IceServer');
const EmailUtils = use('App/Utils/EmailUtils'); const EmailUtils = use('App/Utils/EmailUtils');
const UserUtils = use('App/Utils/UserUtils');
class AdminApiController { class AdminApiController {
async getUsers({response}) { async getUsers({ response }) {
const users = await User.all(); const users = await User.all();
// console.log(typeof users); // console.log(typeof users);
// return users.rows.map(u => { // return users.rows.map(u => {
// return u.publicJSON(); // return u.publicJSON();
// }); // });
return users; return users;
} }
async addStunServer({request, response}) {}
async addTurnServer({request, response}) {} async deleteUser({ request, response }) {
const { id } = request.params
async testEmailSettings({auth, response}) {
try { return UserUtils.deleteUser(id)
if (EmailUtils.sendTestEmail(auth.user)) { }
return {
code: 0, data: {} async addStunServer({ request, response }) {}
} async addTurnServer({ request, response }) {}
}
return { async testEmailSettings({ auth, response }) {
code: 500, message: 'Something went wrong' try {
} if (EmailUtils.sendTestEmail(auth.user)) {
return {
} catch (e) { code: 0,
response.code(500); data: {}
return { }
code: 500, message: e.message }
} return {
code: 500,
message: 'Something went wrong'
}
} catch (e) {
response.code(500);
return {
code: 500,
message: e.message
}
}
} }
}
} }
module.exports = AdminApiController module.exports = AdminApiController

View file

@ -7,54 +7,54 @@ const Hash = use('Hash')
const Model = use('Model') const Model = use('Model')
class User extends Model { class User extends Model {
static boot() { static boot() {
super super
.boot() .boot()
/** /**
* A hook to hash the user password before saving * A hook to hash the user password before saving
* it to the database. * it to the database.
*/ */
this.addHook('beforeSave', async (userInstance) => { this.addHook('beforeSave', async(userInstance) => {
if (userInstance.dirty.password) { if (userInstance.dirty.password) {
userInstance.password = await Hash.make(userInstance.password) userInstance.password = await Hash.make(userInstance.password)
} }
}) })
}
publicJSON() {
const u = this.toJSON();
return {
avatar: `https://api.adorable.io/avatars/285/${u.email}.png`, id: u.id,
name: u.name, isAdmin: u.is_admin
} }
}
static get hidden() { // publicJSON() {
return ['password'] // const u = this.toJSON();
} // return {
// avatar: `https://api.adorable.io/avatars/285/${u.email}.png`, id: u.id,
// name: u.name, isAdmin: u.is_admin
// }
// }
static get dates() { static get hidden() {
return super.dates.concat(['last_logged_in']) return ['password']
} }
/** static get dates() {
* A relationship on tokens is required for auth to return super.dates.concat(['last_logged_in'])
* work. Since features like `refreshTokens` or }
* `rememberToken` will be saved inside the
* tokens table.
*
* @method tokens
*
* @return {Object}
*/
tokens() {
return this.hasMany('App/Models/Token')
}
links() { /**
return this.hasMany('App/Models/Link') * A relationship on tokens is required for auth to
} * work. Since features like `refreshTokens` or
* `rememberToken` will be saved inside the
* tokens table.
*
* @method tokens
*
* @return {Object}
*/
tokens() {
return this.hasMany('App/Models/Token')
}
links() {
return this.hasMany('App/Models/Link')
}
} }
module.exports = User module.exports = User

View file

@ -1,69 +1,78 @@
const Link = use('App/Models/Link'); const Link = use('App/Models/Link');
const Child = use('App/Models/Child');
class UserChildUtils { class UserChildUtils {
static async isUserConnectedToChild(user_id, child_id) { static async isUserConnectedToChild(user_id, child_id) {
const links = await Link.query().where({user_id, child_id}).fetch(); const links = await Link.query().where({ user_id, child_id }).fetch();
return !!links.rows.length; return !!links.rows.length;
} }
static async isParentOf(user_id, child_id) { static async isParentOf(user_id, child_id) {
const links = const links =
await Link.query().where({user_id, child_id, is_parent: true}).fetch(); await Link.query().where({ user_id, child_id, is_parent: true }).fetch();
return !!links.rows.length; return !!links.rows.length;
} }
static async getChildParents(child_id) { static async getChildParents(child_id) {
const links = await Link.query().where({child_id, is_parent: true}).fetch(); const links = await Link.query().where({ child_id, is_parent: true }).fetch();
const parents = await Promise.all(links.rows.map(async l => { const parents = await Promise.all(links.rows.map(async l => {
return l.user().fetch(); return l.user().fetch();
})); }));
return parents; return parents;
} }
static async getUserConnections(user_id) { static async getUserConnections(user_id) {
const links = await Link.query().where({user_id}).fetch(); const links = await Link.query().where({ user_id }).fetch();
const connections = await links.rows.reduce(async (_prev, link) => { const connections = await links.rows.reduce(async(_prev, link) => {
const prev = await _prev; const prev = await _prev;
const is_parent = link.is_parent; const is_parent = link.is_parent;
const child = await link.child().fetch(); const child = await link.child().fetch();
if (is_parent) { if (is_parent) {
const parents = await UserChildUtils.getChildParents(child.id); const parents = await UserChildUtils.getChildParents(child.id);
const nonSameUserParents = parents.filter(p => p.id != user_id); const nonSameUserParents = parents.filter(p => p.id != user_id);
prev.children.push({ prev.children.push({
...child.toJSON(), ...child.toJSON(),
connections: [ connections: [
...await UserChildUtils.getChildConnections(child.id), ...await UserChildUtils.getChildConnections(child.id),
...nonSameUserParents ...nonSameUserParents
] ]
}) })
} else { } else {
prev.connections.push({ prev.connections.push({
...child.toJSON(), ...child.toJSON(),
connections: [...await UserChildUtils.getChildParents(child.id)] connections: [...await UserChildUtils.getChildParents(child.id)]
}) })
} }
return prev; return prev;
}, Promise.resolve({children: [], connections: []})); }, Promise.resolve({ children: [], connections: [] }));
return connections; return connections;
} }
static async getChildConnections(child_id) { static async getChildConnections(child_id) {
const links = const links =
await Link.query().where({child_id, is_parent: false}).fetch(); await Link.query().where({ child_id, is_parent: false }).fetch();
const connections = await Promise.all(links.rows.map(async l => { const connections = await Promise.all(links.rows.map(async l => {
return l.user().fetch(); return l.user().fetch();
})); }));
return connections; return connections;
} }
static async addConnection(child_id, user_id, is_parent = false) { static async addConnection(child_id, user_id, is_parent = false) {
const link = await Link.create({child_id, user_id, is_parent}); const link = await Link.create({ child_id, user_id, is_parent });
const user = await link.user().fetch(); const user = await link.user().fetch();
const child = await link.child().fetch(); const child = await link.child().fetch();
return { return {
user, child, is_parent user,
child,
is_parent
}
}
static async deleteChild(child_id) {
const child = await Child.find(child_id)
const childLinks = await child.links().fetch();
const promises = [...childLinks.rows.map(l => (l.delete())), child.delete()];
return await Promise.all(promises);
} }
}
} }
module.exports = UserChildUtils; module.exports = UserChildUtils;

25
app/Utils/UserUtils.js Normal file
View file

@ -0,0 +1,25 @@
const User = use('App/Models/User');
const UserChildUtils = use('App/Utils/UserChildUtils');
class UserUtils {
static async deleteUser(user_id) {
const user = await User.find(user_id)
let userLinks = await user.links().fetch();
//my links
const links = userLinks.rows;
//children and children links
const childrenLinks = links.filter(l => l.is_parent)
for (const link of childrenLinks) {
await UserChildUtils.deleteChild(link.child_id)
}
const promises = [...links.map(l => (l.delete())), user.delete()];
return await Promise.all(promises);
}
}
module.exports = UserUtils;

View file

@ -1,140 +1,140 @@
'use strict' 'use strict'
module.exports = { module.exports = {
/*
|--------------------------------------------------------------------------
| Content Security Policy
|--------------------------------------------------------------------------
|
| Content security policy filters out the origins not allowed to execute
| and load resources like scripts, styles and fonts. There are wide
| variety of options to choose from.
*/
csp: {
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Directives | Content Security Policy
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| All directives are defined in camelCase and here is the list of | Content security policy filters out the origins not allowed to execute
| available directives and their possible values. | and load resources like scripts, styles and fonts. There are wide
| | variety of options to choose from.
| https://content-security-policy.com
|
| @example
| directives: {
| defaultSrc: ['self', '@nonce', 'cdnjs.cloudflare.com']
| }
|
*/ */
directives: {}, csp: {
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Report only | Directives
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Setting `reportOnly=true` will not block the scripts from running and | All directives are defined in camelCase and here is the list of
| instead report them to a URL. | available directives and their possible values.
| |
*/ | https://content-security-policy.com
reportOnly: false, |
/* | @example
|-------------------------------------------------------------------------- | directives: {
| Set all headers | defaultSrc: ['self', '@nonce', 'cdnjs.cloudflare.com']
|-------------------------------------------------------------------------- | }
| |
| Headers staring with `X` have been depreciated, since all major browsers */
| supports the standard CSP header. So its better to disable deperciated directives: {},
| headers, unless you want them to be set. /*
| |--------------------------------------------------------------------------
*/ | Report only
setAllHeaders: false, |--------------------------------------------------------------------------
|
| Setting `reportOnly=true` will not block the scripts from running and
| instead report them to a URL.
|
*/
reportOnly: false,
/*
|--------------------------------------------------------------------------
| Set all headers
|--------------------------------------------------------------------------
|
| Headers staring with `X` have been depreciated, since all major browsers
| supports the standard CSP header. So its better to disable deperciated
| headers, unless you want them to be set.
|
*/
setAllHeaders: false,
/*
|--------------------------------------------------------------------------
| Disable on android
|--------------------------------------------------------------------------
|
| Certain versions of android are buggy with CSP policy. So you can set
| this value to true, to disable it for Android versions with buggy
| behavior.
|
| Here is an issue reported on a different package, but helpful to read
| if you want to know the behavior.
https://github.com/helmetjs/helmet/pull/82
|
*/
disableAndroid: true
},
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Disable on android | X-XSS-Protection
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Certain versions of android are buggy with CSP policy. So you can set | X-XSS Protection saves applications from XSS attacks. It is adopted
| this value to true, to disable it for Android versions with buggy | by IE and later followed by some other browsers.
| behavior.
| |
| Here is an issue reported on a different package, but helpful to read | Learn more at
| if you want to know the behavior. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
https://github.com/helmetjs/helmet/pull/82
| |
*/ */
disableAndroid: true xss: { enabled: true, enableOnOldIE: false },
},
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| X-XSS-Protection | Iframe Options
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| X-XSS Protection saves applications from XSS attacks. It is adopted | xframe defines whether or not your website can be embedded inside an
| by IE and later followed by some other browsers. | iframe. Choose from one of the following options.
| | @available options
| Learn more at | DENY, SAMEORIGIN, ALLOW-FROM http://example.com
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection |
| | Learn more at
*/ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
xss: {enabled: true, enableOnOldIE: false}, */
xframe: 'DENY',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Iframe Options | No Sniff
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| xframe defines whether or not your website can be embedded inside an | Browsers have a habit of sniffing content-type of a response. Which means
| iframe. Choose from one of the following options. | files with .txt extension containing Javascript code will be executed as
| @available options | Javascript. You can disable this behavior by setting nosniff to false.
| DENY, SAMEORIGIN, ALLOW-FROM http://example.com |
| | Learn more at
| Learn more at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options |
*/ */
xframe: 'DENY', nosniff: true,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| No Sniff | No Open
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Browsers have a habit of sniffing content-type of a response. Which means | IE users can execute webpages in the context of your website, which is
| files with .txt extension containing Javascript code will be executed as | a serious security risk. Below option will manage this for you.
| Javascript. You can disable this behavior by setting nosniff to false. |
| */
| Learn more at noopen: true,
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
|
*/
nosniff: true,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| No Open | CSRF Protection
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| IE users can execute webpages in the context of your website, which is | CSRF Protection adds another layer of security by making sure, actionable
| a serious security risk. Below option will manage this for you. | routes does have a valid token to execute an action.
| |
*/ */
noopen: true, csrf: {
enable: true,
/* methods: ['POST', 'PUT', 'DELETE'],
|-------------------------------------------------------------------------- filterUris: [/api\/v1\/client\/\w+/, /api\/v1\/admin\/\w+/], // All Client API routes
| CSRF Protection cookieOptions: { httpOnly: false, sameSite: true, path: '/', maxAge: 7200 }
|-------------------------------------------------------------------------- }
| }
| CSRF Protection adds another layer of security by making sure, actionable
| routes does have a valid token to execute an action.
|
*/
csrf: {
enable: true,
methods: ['POST', 'PUT', 'DELETE'],
filterUris: [/api\/v1\/client\/\w+/], // All Client API routes
cookieOptions: {httpOnly: false, sameSite: true, path: '/', maxAge: 7200}
}
}

314
package-lock.json generated
View file

@ -433,6 +433,32 @@
"lodash": "^4.17.11" "lodash": "^4.17.11"
} }
}, },
"@adonisjs/vow": {
"version": "1.0.17",
"resolved": "https://registry.npmjs.org/@adonisjs/vow/-/vow-1.0.17.tgz",
"integrity": "sha512-fj5LO0w8VuQeKTdUPQ1+F0Z+GLwJ8qFwEN8GIxER0bg8Q0d8qOBsFulwozAyYMVf8xklKvzJgFeXFkexNJYaOA==",
"requires": {
"chai-subset": "^1.6.0",
"debug": "^4.0.1",
"globby": "^8.0.1",
"japa": "1.0.6",
"lodash": "^4.17.11",
"macroable": "^1.0.0",
"node-cookie": "^2.1.1",
"p-series": "^1.1.0",
"superagent": "^4.0.0-beta.5"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
}
}
},
"@adonisjs/websocket": { "@adonisjs/websocket": {
"version": "1.0.12", "version": "1.0.12",
"resolved": "https://registry.npmjs.org/@adonisjs/websocket/-/websocket-1.0.12.tgz", "resolved": "https://registry.npmjs.org/@adonisjs/websocket/-/websocket-1.0.12.tgz",
@ -764,6 +790,20 @@
"to-fast-properties": "^2.0.0" "to-fast-properties": "^2.0.0"
} }
}, },
"@mrmlnc/readdir-enhanced": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
"integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==",
"requires": {
"call-me-maybe": "^1.0.1",
"glob-to-regexp": "^0.3.0"
}
},
"@nodelib/fs.stat": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz",
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
},
"@sindresorhus/is": { "@sindresorhus/is": {
"version": "0.7.0", "version": "0.7.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz",
@ -1450,6 +1490,14 @@
"resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz",
"integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==" "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w=="
}, },
"array-union": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
"integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
"requires": {
"array-uniq": "^1.0.1"
}
},
"array-uniq": { "array-uniq": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz", "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz",
@ -1460,6 +1508,11 @@
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
"integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg="
}, },
"arrify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
"integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0="
},
"asn1": { "asn1": {
"version": "0.2.4", "version": "0.2.4",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
@ -1521,6 +1574,11 @@
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true "dev": true
}, },
"assertion-error": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw=="
},
"assign-symbols": { "assign-symbols": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
@ -2710,6 +2768,11 @@
} }
} }
}, },
"call-me-maybe": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz",
"integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms="
},
"caller": { "caller": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/caller/-/caller-1.0.1.tgz", "resolved": "https://registry.npmjs.org/caller/-/caller-1.0.1.tgz",
@ -2774,6 +2837,24 @@
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"dev": true "dev": true
}, },
"chai": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz",
"integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
"requires": {
"assertion-error": "^1.1.0",
"check-error": "^1.0.2",
"deep-eql": "^3.0.1",
"get-func-name": "^2.0.0",
"pathval": "^1.1.0",
"type-detect": "^4.0.5"
}
},
"chai-subset": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/chai-subset/-/chai-subset-1.6.0.tgz",
"integrity": "sha1-pdDKFOMpp5WW7XAFi2ZGvWmIz+k="
},
"chalk": { "chalk": {
"version": "2.4.2", "version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@ -2789,6 +2870,11 @@
"resolved": "https://registry.npmjs.org/chance/-/chance-1.1.5.tgz", "resolved": "https://registry.npmjs.org/chance/-/chance-1.1.5.tgz",
"integrity": "sha512-uBVETzUktMGLALWQ8fCJCOjNF4Gm1lRjjjuC2+z7rCjx78ioONIK7bYhGzBovhQyqOegJEl3nAJxjE7mvY6aIw==" "integrity": "sha512-uBVETzUktMGLALWQ8fCJCOjNF4Gm1lRjjjuC2+z7rCjx78ioONIK7bYhGzBovhQyqOegJEl3nAJxjE7mvY6aIw=="
}, },
"check-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII="
},
"choices-separator": { "choices-separator": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/choices-separator/-/choices-separator-2.0.0.tgz", "resolved": "https://registry.npmjs.org/choices-separator/-/choices-separator-2.0.0.tgz",
@ -3249,6 +3335,11 @@
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.1.0.tgz", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.1.0.tgz",
"integrity": "sha512-Alvs19Vgq07eunykd3Xy2jF0/qSNv2u7KDbAek9H5liV1UMijbqFs5cycZvv5dVsvseT/U4H8/7/w8Koh35C4A==" "integrity": "sha512-Alvs19Vgq07eunykd3Xy2jF0/qSNv2u7KDbAek9H5liV1UMijbqFs5cycZvv5dVsvseT/U4H8/7/w8Koh35C4A=="
}, },
"cookiejar": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz",
"integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA=="
},
"copy-concurrently": { "copy-concurrently": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
@ -3497,6 +3588,14 @@
"mimic-response": "^1.0.0" "mimic-response": "^1.0.0"
} }
}, },
"deep-eql": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
"requires": {
"type-detect": "^4.0.0"
}
},
"deep-extend": { "deep-extend": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
@ -3584,6 +3683,30 @@
} }
} }
}, },
"dir-glob": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz",
"integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==",
"requires": {
"arrify": "^1.0.1",
"path-type": "^3.0.0"
},
"dependencies": {
"path-type": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
"integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
"requires": {
"pify": "^3.0.0"
}
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
}
}
},
"domain-browser": { "domain-browser": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
@ -4004,6 +4127,19 @@
"integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==",
"dev": true "dev": true
}, },
"fast-glob": {
"version": "2.2.7",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz",
"integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==",
"requires": {
"@mrmlnc/readdir-enhanced": "^2.2.1",
"@nodelib/fs.stat": "^1.1.2",
"glob-parent": "^3.1.0",
"is-glob": "^4.0.0",
"merge2": "^1.2.3",
"micromatch": "^3.1.10"
}
},
"fast-json-stable-stringify": { "fast-json-stable-stringify": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@ -4154,6 +4290,11 @@
"mime-types": "^2.1.12" "mime-types": "^2.1.12"
} }
}, },
"formidable": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.2.tgz",
"integrity": "sha512-V8gLm+41I/8kguQ4/o1D3RIHRmhYFG4pnNyonvua+40rqcEmT4+V71yaZ3B457xbbgCsCfjSPi65u/W6vK1U5Q=="
},
"forwarded": { "forwarded": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
@ -4294,6 +4435,11 @@
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true "dev": true
}, },
"get-func-name": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE="
},
"get-stdin": { "get-stdin": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
@ -4354,6 +4500,11 @@
} }
} }
}, },
"glob-to-regexp": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz",
"integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs="
},
"global-dirs": { "global-dirs": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz",
@ -4388,6 +4539,27 @@
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
"dev": true "dev": true
}, },
"globby": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/globby/-/globby-8.0.2.tgz",
"integrity": "sha512-yTzMmKygLp8RUpG1Ymu2VXPSJQZjNAZPD4ywgYEaG7e4tBJeUQBO8OpXrf1RCNcEs5alsoJYPAMiIHP0cmeC7w==",
"requires": {
"array-union": "^1.0.1",
"dir-glob": "2.0.0",
"fast-glob": "^2.0.2",
"glob": "^7.1.2",
"ignore": "^3.3.5",
"pify": "^3.0.0",
"slash": "^1.0.0"
},
"dependencies": {
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
}
}
},
"globule": { "globule": {
"version": "1.3.1", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz", "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz",
@ -4458,7 +4630,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"dev": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@ -4654,6 +4825,11 @@
"integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=",
"dev": true "dev": true
}, },
"ignore": {
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz",
"integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug=="
},
"ignore-by-default": { "ignore-by-default": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
@ -5063,6 +5239,19 @@
"is-object": "^1.0.1" "is-object": "^1.0.1"
} }
}, },
"japa": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/japa/-/japa-1.0.6.tgz",
"integrity": "sha512-WDc1/hdlTr2Sb37AZEAKvg9Hs8x2LermeqkQHtLVYn1MRnu8QPjywX/rCSda7xn6w9MScKQeQ8xKfXrDsE3cMQ==",
"requires": {
"chai": "^4.1.2",
"chalk": "^2.3.0",
"ms": "^2.1.1",
"retry": "^0.10.1",
"right-pad": "^1.0.1",
"variable-diff": "^1.1.0"
}
},
"js-base64": { "js-base64": {
"version": "2.5.2", "version": "2.5.2",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz",
@ -5743,6 +5932,16 @@
} }
} }
}, },
"merge2": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz",
"integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw=="
},
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
},
"micromatch": { "micromatch": {
"version": "3.1.10", "version": "3.1.10",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
@ -6661,6 +6860,20 @@
"p-limit": "^2.0.0" "p-limit": "^2.0.0"
} }
}, },
"p-reduce": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
"integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo="
},
"p-series": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/p-series/-/p-series-1.1.0.tgz",
"integrity": "sha512-356covArc9UCfj2twY/sxCJKGMzzO+pJJtucizsPC6aS1xKSTBc9PQrQhvFR3+7F+fa2KBKdJjdIcv6NEWDcIQ==",
"requires": {
"@sindresorhus/is": "^0.7.0",
"p-reduce": "^1.0.0"
}
},
"p-timeout": { "p-timeout": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz",
@ -6825,6 +7038,11 @@
} }
} }
}, },
"pathval": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA="
},
"pbkdf2": { "pbkdf2": {
"version": "3.0.17", "version": "3.0.17",
"resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz",
@ -8013,6 +8231,16 @@
"resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg=="
}, },
"retry": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz",
"integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q="
},
"right-pad": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/right-pad/-/right-pad-1.0.1.tgz",
"integrity": "sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA="
},
"rimraf": { "rimraf": {
"version": "2.7.1", "version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
@ -8334,6 +8562,11 @@
} }
} }
}, },
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU="
},
"snapdragon": { "snapdragon": {
"version": "0.8.2", "version": "0.8.2",
"resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
@ -8808,6 +9041,47 @@
"resolved": "https://registry.npmjs.org/success-symbol/-/success-symbol-0.1.0.tgz", "resolved": "https://registry.npmjs.org/success-symbol/-/success-symbol-0.1.0.tgz",
"integrity": "sha1-JAIuSG878c3KCUKDt2nEctO3KJc=" "integrity": "sha1-JAIuSG878c3KCUKDt2nEctO3KJc="
}, },
"superagent": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/superagent/-/superagent-4.1.0.tgz",
"integrity": "sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==",
"requires": {
"component-emitter": "^1.2.0",
"cookiejar": "^2.1.2",
"debug": "^4.1.0",
"form-data": "^2.3.3",
"formidable": "^1.2.0",
"methods": "^1.1.1",
"mime": "^2.4.0",
"qs": "^6.6.0",
"readable-stream": "^3.0.6"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"mime": {
"version": "2.4.5",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.5.tgz",
"integrity": "sha512-3hQhEUF027BuxZjQA3s7rIv/7VCQPa27hN9u9g87sEkWaKwQPuXOkVKtOeiyUrnWqTDiOs8Ed2rwg733mB0R5w=="
},
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
}
}
}
},
"supports-color": { "supports-color": {
"version": "5.5.0", "version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
@ -9249,6 +9523,11 @@
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
"dev": true "dev": true
}, },
"type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g=="
},
"type-is": { "type-is": {
"version": "1.6.18", "version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
@ -9542,6 +9821,39 @@
"spdx-expression-parse": "^3.0.0" "spdx-expression-parse": "^3.0.0"
} }
}, },
"variable-diff": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/variable-diff/-/variable-diff-1.1.0.tgz",
"integrity": "sha1-0r1cZtt2wTh52W5qMG7cmJ35eNo=",
"requires": {
"chalk": "^1.1.1",
"object-assign": "^4.0.1"
},
"dependencies": {
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"requires": {
"ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2",
"has-ansi": "^2.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
}
},
"supports-color": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
}
}
},
"vary": { "vary": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",

View file

@ -1,77 +1,79 @@
{ {
"name": "Seepur", "name": "Seepur",
"version": "0.0.1", "version": "0.0.1",
"adonis-version": "4.1.0", "adonis-version": "4.1.0",
"description": "A shared story time experience", "description": "A shared story time experience",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {
"build:css": "npx node-sass --omit-source-map-url resources/sass/main.scss public/style.css", "build:css": "npx node-sass --omit-source-map-url resources/sass/main.scss public/style.css",
"build:applications": "npx webpack --mode production", "build:applications": "npx webpack --mode production",
"watch:css": "npm run build:css -- --watch", "watch:css": "npm run build:css -- --watch",
"watch:applications": "npx webpack --watch", "watch:applications": "npx webpack --watch",
"migrate": "npx adonis migration:run -f", "migrate": "npx adonis migration:run -f",
"build": "npm run migrate && npm run build:css && npm run build:applications", "build": "npm run migrate && npm run build:css && npm run build:applications",
"start": "npm run migrate && node server.js", "start": "npm run migrate && node server.js",
"clean": "bash clean-hot-update.sh", "start:dev": "npx adonis serve --dev",
"test": "node ace test" "clean": "bash clean-hot-update.sh",
}, "test": "node ace test"
"keywords": [ },
"seepur" "keywords": [
], "seepur"
"author": "", ],
"license": "UNLICENSED", "author": "",
"private": true, "license": "UNLICENSED",
"dependencies": { "private": true,
"@adonisjs/ace": "^5.0.8", "dependencies": {
"@adonisjs/auth": "^3.0.7", "@adonisjs/ace": "^5.0.8",
"@adonisjs/bodyparser": "^2.0.5", "@adonisjs/auth": "^3.0.7",
"@adonisjs/cli": "^4.0.12", "@adonisjs/bodyparser": "^2.0.5",
"@adonisjs/cors": "^1.0.7", "@adonisjs/cli": "^4.0.12",
"@adonisjs/drive": "^1.0.4", "@adonisjs/cors": "^1.0.7",
"@adonisjs/fold": "^4.0.9", "@adonisjs/drive": "^1.0.4",
"@adonisjs/framework": "^5.0.9", "@adonisjs/fold": "^4.0.9",
"@adonisjs/ignitor": "^2.0.8", "@adonisjs/framework": "^5.0.9",
"@adonisjs/lucid": "^6.1.3", "@adonisjs/ignitor": "^2.0.8",
"@adonisjs/mail": "^3.0.10", "@adonisjs/lucid": "^6.1.3",
"@adonisjs/redis": "^2.0.7", "@adonisjs/mail": "^3.0.10",
"@adonisjs/session": "^1.0.27", "@adonisjs/redis": "^2.0.7",
"@adonisjs/shield": "^1.0.8", "@adonisjs/session": "^1.0.27",
"@adonisjs/validator": "^5.0.6", "@adonisjs/shield": "^1.0.8",
"@adonisjs/websocket": "^1.0.12", "@adonisjs/validator": "^5.0.6",
"@adonisjs/websocket-client": "^1.0.9", "@adonisjs/vow": "^1.0.17",
"adonis-vue-websocket": "^2.0.2", "@adonisjs/websocket": "^1.0.12",
"animate.css": "^4.1.0", "@adonisjs/websocket-client": "^1.0.9",
"bulma": "^0.8.0", "adonis-vue-websocket": "^2.0.2",
"fork-awesome": "^1.1.7", "animate.css": "^4.1.0",
"moment": "^2.24.0", "bulma": "^0.8.0",
"regenerator-runtime": "^0.13.5", "fork-awesome": "^1.1.7",
"rematrix": "^0.7.0", "moment": "^2.24.0",
"sqlite3": "^4.1.1", "regenerator-runtime": "^0.13.5",
"typescript": "^3.7.5", "rematrix": "^0.7.0",
"uuid": "^8.0.0", "sqlite3": "^4.1.1",
"vue": "^2.6.11", "typescript": "^3.7.5",
"vue-croppa": "^1.3.8", "uuid": "^8.0.0",
"vue-router": "^3.1.5", "vue": "^2.6.11",
"vuex": "^3.1.2" "vue-croppa": "^1.3.8",
}, "vue-router": "^3.1.5",
"devDependencies": { "vuex": "^3.1.2"
"@babel/core": "^7.8.3", },
"@babel/plugin-transform-regenerator": "^7.8.7", "devDependencies": {
"@babel/plugin-transform-runtime": "^7.9.0", "@babel/core": "^7.8.3",
"@types/node": "^14.0.1", "@babel/plugin-transform-regenerator": "^7.8.7",
"babel-loader": "^8.0.6", "@babel/plugin-transform-runtime": "^7.9.0",
"babel-preset-env": "^1.7.0", "@types/node": "^14.0.1",
"babel-preset-stage-2": "^6.24.1", "babel-loader": "^8.0.6",
"css-loader": "^3.4.2", "babel-preset-env": "^1.7.0",
"node-sass": "^4.13.0", "babel-preset-stage-2": "^6.24.1",
"ts-loader": "^7.0.4", "css-loader": "^3.4.2",
"vue-loader": "^15.8.3", "node-sass": "^4.13.0",
"vue-style-loader": "^4.1.2", "ts-loader": "^7.0.4",
"vue-template-compiler": "^2.6.11", "vue-loader": "^15.8.3",
"webpack": "^4.41.5", "vue-style-loader": "^4.1.2",
"webpack-cli": "^3.3.10" "vue-template-compiler": "^2.6.11",
}, "webpack": "^4.41.5",
"autoload": { "webpack-cli": "^3.3.10"
"App": "./app" },
} "autoload": {
"App": "./app"
}
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,9 @@
<Modal title="CreateUser" :isActive="showCreateUser" @close="showCreateUser=false" acceptText="Create" @accept="createUser()"> <Modal title="CreateUser" :isActive="showCreateUser" @close="showCreateUser=false" acceptText="Create" @accept="createUser()">
test test
</Modal> </Modal>
<Modal title="DeleteUser" :isActive="showDeleteUser" @close="showDeleteUser=false; currentUser=null" acceptText="Delete" rejectText="Cancel" @accept="deleteUser(currentUser)">
Are you sure you want to delete {{currentUser !== null ? currentUser.name: ''}}?
</Modal>
<nav class="level"> <nav class="level">
<div class="level-left"> <div class="level-left">
<div class="level-item"> <div class="level-item">
@ -35,6 +38,7 @@
<th>name</th> <th>name</th>
<th>email</th> <th>email</th>
<th>admin</th> <th>admin</th>
<th>edit</th>
</tr> </tr>
</thead> </thead>
<tr v-for="user in users" :key="user.id"> <tr v-for="user in users" :key="user.id">
@ -49,13 +53,16 @@
<td> <td>
<input class="checkbox" type="checkbox" :checked="user.is_admin" /> <input class="checkbox" type="checkbox" :checked="user.is_admin" />
</td> </td>
<td>
<button v-if="!user.is_admin" class="button" @click="onDeleteClicked(user)">Delete</button>
<button v-if="!user.is_admin" class="button" @click="onEditClicked(user)">Edit</button>
</td>
</tr> </tr>
</table> </table>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import ChildAvatar, { IChildAvatar } from "../components/child_avatar.vue";
import Services from "../../services/index"; import Services from "../../services/index";
import { mapGetters, mapActions } from "vuex"; import { mapGetters, mapActions } from "vuex";
import Modal from "../../shared/components/Modal/Modal.vue"; import Modal from "../../shared/components/Modal/Modal.vue";
@ -63,22 +70,32 @@ import Modal from "../../shared/components/Modal/Modal.vue";
export default { export default {
name: "Home", name: "Home",
components: { components: {
ChildAvatar,
Modal Modal
}, },
methods: { methods: {
createUser(){ createUser(){
alert('created'); alert('created');
}, },
async deleteUser(user){
console.log(user)
await Services.ApiService.deleteUser(user);
this.showDeleteUser=false;
await this.getUsers()
},
onDeleteClicked(user){
this.showDeleteUser = true;
this.currentUser = user;
},
onEditClicked(user){
// //this.showEditUser = true;
// //this.currentUser = user;
},
...mapActions(["getUsers"]) ...mapActions(["getUsers"])
}, },
async created() { async created() {
this.loading = true; this.loading = true;
if (this.users === null) await this.getUsers(); if (this.users === null) await this.getUsers();
this.loading = false; this.loading = false;
// this.connections = await Services.ApiService.getConnections();
// this.users = await Services.ApiService.getAllUsers();
// console.dir(connections);
}, },
computed: { computed: {
// async users() { // async users() {
@ -89,6 +106,8 @@ export default {
return { return {
loading: true, loading: true,
showCreateUser: false, showCreateUser: false,
showDeleteUser: false,
currentUser: null,
}; };
} }
}; };

View file

@ -1,5 +1,15 @@
export default class ApiService { export default class ApiService {
static async deleteUser(user: any) {
try{
return (await fetch(`/api/v1/admin/user/${user.id}`, {method: 'DELETE'})).json();
}
catch (e) {
console.error(`deleteUser ERROR: ${e.message}`);
return e;
}
}
static async getUser(userId?: number) { static async getUser(userId?: number) {
try { try {
return (await fetch('/api/v1/client/user/')).json(); return (await fetch('/api/v1/client/user/')).json();

View file

@ -10,47 +10,49 @@
| provider here. | provider here.
| |
*/ */
const providers = const providers = [
[ '@adonisjs/framework/providers/AppProvider',
'@adonisjs/framework/providers/AppProvider', '@adonisjs/framework/providers/ViewProvider',
'@adonisjs/framework/providers/ViewProvider', '@adonisjs/lucid/providers/LucidProvider',
'@adonisjs/lucid/providers/LucidProvider', '@adonisjs/bodyparser/providers/BodyParserProvider',
'@adonisjs/bodyparser/providers/BodyParserProvider', '@adonisjs/cors/providers/CorsProvider',
'@adonisjs/cors/providers/CorsProvider', '@adonisjs/shield/providers/ShieldProvider',
'@adonisjs/shield/providers/ShieldProvider', '@adonisjs/session/providers/SessionProvider',
'@adonisjs/session/providers/SessionProvider', '@adonisjs/auth/providers/AuthProvider',
'@adonisjs/auth/providers/AuthProvider', '@adonisjs/validator/providers/ValidatorProvider',
'@adonisjs/validator/providers/ValidatorProvider', '@adonisjs/drive/providers/DriveProvider',
'@adonisjs/drive/providers/DriveProvider', '@adonisjs/websocket/providers/WsProvider',
'@adonisjs/websocket/providers/WsProvider', '@adonisjs/mail/providers/MailProvider',
'@adonisjs/mail/providers/MailProvider', '@adonisjs/redis/providers/RedisProvider',
'@adonisjs/redis/providers/RedisProvider', ]
]
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Ace Providers | Ace Providers
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Ace providers are required only when running ace commands. For example | Ace providers are required only when running ace commands. For example
| Providers for migrations, tests etc. | Providers for migrations, tests etc.
| |
*/ */
const aceProviders = ['@adonisjs/lucid/providers/MigrationsProvider'] const aceProviders = [
'@adonisjs/lucid/providers/MigrationsProvider',
'@adonisjs/vow/providers/VowProvider'
]
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Aliases | Aliases
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Aliases are short unique names for IoC container bindings. You are free | Aliases are short unique names for IoC container bindings. You are free
| to create your own aliases. | to create your own aliases.
| |
| For example: | For example:
| { Route: 'Adonis/Src/Route' } | { Route: 'Adonis/Src/Route' }
| |
*/ */
const aliases = {} const aliases = {}
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -63,8 +65,8 @@ const providers =
const commands = [] const commands = []
module.exports = { module.exports = {
providers, providers,
aceProviders, aceProviders,
aliases, aliases,
commands commands
} }

View file

@ -28,13 +28,13 @@ Route.post('/login', 'AuthController.login').validator('Login');
// reset-password // reset-password
Route.post('/password/request/reset', 'AuthController.resetPasswordRequest') Route.post('/password/request/reset', 'AuthController.resetPasswordRequest')
.validator('ResetPasswordRequest') .validator('ResetPasswordRequest')
.as('resetPasswordRequest'); .as('resetPasswordRequest');
Route.get('/password/reset', 'AuthController.resetPasswordRequestIndex'); Route.get('/password/reset', 'AuthController.resetPasswordRequestIndex');
Route.get('/password/reset/:token', 'AuthController.resetPasswordIndex'); Route.get('/password/reset/:token', 'AuthController.resetPasswordIndex');
Route.post('/password/reset', 'AuthController.resetPassword') Route.post('/password/reset', 'AuthController.resetPassword')
.validator('ResetPassword') .validator('ResetPassword')
.as('resetPassword'); .as('resetPassword');
/* /*
/ Client API / Client API
@ -42,12 +42,12 @@ Route.post('/password/reset', 'AuthController.resetPassword')
Route Route
.group(() => { .group(() => {
Route.post('connections/create', 'ClientApiController.createConnection'); Route.post('connections/create', 'ClientApiController.createConnection');
Route.get('user', 'ClientApiController.getUser'); Route.get('user', 'ClientApiController.getUser');
Route.post('child', 'ClientApiController.createChild'); Route.post('child', 'ClientApiController.createChild');
Route.get('child/:id', 'ClientApiController.getChild'); Route.get('child/:id', 'ClientApiController.getChild');
Route.post('child/:id', 'ClientApiController.updateChild'); Route.post('child/:id', 'ClientApiController.updateChild');
Route.post('call/create', 'ClientApiController.createCall'); Route.post('call/create', 'ClientApiController.createCall');
}) })
.prefix('api/v1/client') .prefix('api/v1/client')
.middleware(['auth']); .middleware(['auth']);
@ -65,9 +65,9 @@ Route
*/ */
Route.get('/u/books/:bookId/thumbnail', 'BookApiController.getThumbnail') Route.get('/u/books/:bookId/thumbnail', 'BookApiController.getThumbnail')
.middleware(['auth', 'BookContext']) .middleware(['auth', 'BookContext'])
/* /*
/ Pubic CDN Images / Pubic CDN Images
*/ */
Route.get('/u/images/:fileName', 'CdnController.publicImages'); Route.get('/u/images/:fileName', 'CdnController.publicImages');
/* /*
@ -76,16 +76,17 @@ Route.get('/u/images/:fileName', 'CdnController.publicImages');
// API // API
Route Route
.group(() => { .group(() => {
Route.get('users', 'AdminApiController.getUsers'); Route.get('users', 'AdminApiController.getUsers');
Route.get( Route.delete('user/:id', 'AdminApiController.deleteUser');
'settings/email/test/result', 'AdminApiController.testEmailSettings'); Route.get(
'settings/email/test/result', 'AdminApiController.testEmailSettings');
}) })
.prefix('/api/v1/admin') .prefix('/api/v1/admin')
.middleware(['auth', 'adminAuth']); .middleware(['auth', 'adminAuth']);
Route Route
.group(() => { .group(() => {
// //
Route.get('/*', 'AdminController.index'); Route.get('/*', 'AdminController.index');
}) })
.prefix('admin') .prefix('admin')
.middleware(['auth', 'adminAuth']); .middleware(['auth', 'adminAuth']);
@ -104,4 +105,4 @@ Route
// // return auth.user; // // return auth.user;
// }) // })
// .middleware(['auth']); // .middleware(['auth']);
Route.get('/*', 'IndexController.index').as('home'); Route.get('/*', 'IndexController.index').as('home');

View file

@ -0,0 +1,26 @@
'use strict'
const { test } = use('Test/Suite')('Users')
const Child = use('App/Models/Child');
const User = use('App/Models/User');
const UserUtils = use('App/Utils/UserUtils');
test('User is deleted', async({ assert }) => {
const user = await User.create({
email: 'test@mail.com',
name: 'test',
password: 'password',
avatar: `/images/default-user-avatar.png`,
is_admin: false
});
await user.save();
const newUser = await User.query().where({ name: 'test' }).fetch();
assert.equal(newUser.rows.length, 1)
await UserUtils.deleteUser(newUser.rows[0].id)
const usersAfterDel = await User.query().where({ name: 'test' }).fetch();
assert.equal(usersAfterDel.rows.length, 0)
})

View file

@ -0,0 +1,7 @@
'use strict'
const { test } = use('Test/Suite')('Example')
test('make sure 2 + 2 is 4', async ({ assert }) => {
assert.equal(2 + 2, 4)
})

62
vowfile.js Normal file
View file

@ -0,0 +1,62 @@
'use strict'
/*
|--------------------------------------------------------------------------
| Vow file
|--------------------------------------------------------------------------
|
| The vow file is loaded before running your tests. This is the best place
| to hook operations `before` and `after` running the tests.
|
*/
// Uncomment when want to run migrations
// const ace = require('@adonisjs/ace')
module.exports = (cli, runner) => {
runner.before(async () => {
/*
|--------------------------------------------------------------------------
| Start the server
|--------------------------------------------------------------------------
|
| Starts the http server before running the tests. You can comment this
| line, if http server is not required
|
*/
use('Adonis/Src/Server').listen(process.env.HOST, process.env.PORT)
/*
|--------------------------------------------------------------------------
| Run migrations
|--------------------------------------------------------------------------
|
| Migrate the database before starting the tests.
|
*/
// await ace.call('migration:run', {}, { silent: true })
})
runner.after(async () => {
/*
|--------------------------------------------------------------------------
| Shutdown server
|--------------------------------------------------------------------------
|
| Shutdown the HTTP server when all tests have been executed.
|
*/
use('Adonis/Src/Server').getInstance().close()
/*
|--------------------------------------------------------------------------
| Rollback migrations
|--------------------------------------------------------------------------
|
| Once all tests have been completed, we should reset the database to it's
| original state
|
*/
// await ace.call('migration:reset', {}, { silent: true })
})
}