mirror of
https://github.com/documize/community.git
synced 2025-08-08 06:55:28 +02:00
Add more stubbed api routes
This commit is contained in:
parent
f4b003525d
commit
0db8152143
3 changed files with 395 additions and 212 deletions
|
@ -1,153 +1,348 @@
|
||||||
export default function() {
|
export default function() {
|
||||||
|
|
||||||
this.passthrough('https://widget.intercom.io/widget/%7Bapp_id%7D');
|
this.passthrough('https://widget.intercom.io/widget/%7Bapp_id%7D');
|
||||||
this.urlPrefix = 'https://localhost:5001'; // make this `http://localhost:8080`, for example, if your API is on a different server
|
this.urlPrefix = 'https://localhost:5001'; // make this `http://localhost:8080`, for example, if your API is on a different server
|
||||||
this.namespace = 'api'; // make this `api`, for example, if your API is namespaced
|
this.namespace = 'api'; // make this `api`, for example, if your API is namespaced
|
||||||
// this.timing = 400; // delay for each request, automatically set to 0 during testing
|
// this.timing = 400; // delay for each request, automatically set to 0 during testing
|
||||||
|
|
||||||
this.get('/public/meta', function () {
|
this.get('/public/meta', function() {
|
||||||
return {
|
return {
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
"title":"EmberSherpa",
|
"title": "EmberSherpa",
|
||||||
"message":"This Documize instance contains all our team documentation",
|
"message": "This Documize instance contains all our team documentation",
|
||||||
"url":"",
|
"url": "",
|
||||||
"allowAnonymousAccess":true,
|
"allowAnonymousAccess": false,
|
||||||
"version":"11.2"
|
"version": "11.2"
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/public/validate', function (db, request) {
|
this.get('/public/validate', function(db, request) {
|
||||||
let serverToken = request.queryParams.token;
|
let serverToken = request.queryParams.token;
|
||||||
let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0"
|
let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0";
|
||||||
|
|
||||||
if(token = serverToken){
|
if (token = serverToken) {
|
||||||
return {
|
return {
|
||||||
"id":"VzMuyEw_3WqiafcE",
|
"id": "VzMuyEw_3WqiafcE",
|
||||||
"created":"2016-05-11T15:08:24Z",
|
"created": "2016-05-11T15:08:24Z",
|
||||||
"revised":"2016-05-11T15:08:24Z",
|
"revised": "2016-05-11T15:08:24Z",
|
||||||
"firstname":"Lennex",
|
"firstname": "Lennex",
|
||||||
"lastname":"Zinyando",
|
"lastname": "Zinyando",
|
||||||
"email":"brizdigital@gmail.com",
|
"email": "brizdigital@gmail.com",
|
||||||
"initials":"LZ",
|
"initials": "LZ",
|
||||||
"active":true,
|
"active": true,
|
||||||
"editor":true,
|
"editor": true,
|
||||||
"admin":true,
|
"admin": true,
|
||||||
"accounts":[{
|
"accounts": [{
|
||||||
"id":"VzMuyEw_3WqiafcF",
|
"id": "VzMuyEw_3WqiafcF",
|
||||||
"created":"2016-05-11T15:08:24Z",
|
"created": "2016-05-11T15:08:24Z",
|
||||||
"revised":"2016-05-11T15:08:24Z",
|
"revised": "2016-05-11T15:08:24Z",
|
||||||
"admin":true,
|
"admin": true,
|
||||||
"editor":true,
|
"editor": true,
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
"company":"EmberSherpa",
|
"company": "EmberSherpa",
|
||||||
"title":"EmberSherpa",
|
"title": "EmberSherpa",
|
||||||
"message":"This Documize instance contains all our team documentation",
|
"message": "This Documize instance contains all our team documentation",
|
||||||
"domain":""
|
"domain": ""
|
||||||
}
|
}]
|
||||||
]
|
};
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/users/0/permissions', function () {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
"folderId":"VzMygEw_3WrtFzto",
|
|
||||||
"userId":"",
|
|
||||||
"canView":true,
|
|
||||||
"canEdit":false
|
|
||||||
}
|
}
|
||||||
];
|
});
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/templates', function () {
|
this.get('/users/0/permissions', function() {
|
||||||
return [];
|
return [{
|
||||||
});
|
"folderId": "VzMygEw_3WrtFzto",
|
||||||
|
"userId": "",
|
||||||
|
"canView": true,
|
||||||
|
"canEdit": false
|
||||||
|
}];
|
||||||
|
});
|
||||||
|
|
||||||
this.get('/folders/VzMuyEw_3WqiafcG', function () {
|
this.get('/templates', function() {
|
||||||
return {
|
return [];
|
||||||
"id":"VzMuyEw_3WqiafcG",
|
});
|
||||||
"created":"2016-05-11T15:08:24Z",
|
|
||||||
"revised":"2016-05-11T15:08:24Z",
|
|
||||||
"name":"My Project",
|
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
|
||||||
"folderType":2
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/documents', function (db, request) {
|
this.get('/folders/VzMuyEw_3WqiafcG', function() {
|
||||||
let folder_id = request.queryParams.folder;
|
|
||||||
|
|
||||||
if (folder_id = "VzMuyEw_3WqiafcG"){
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
"id":"VzMwX0w_3WrtFztd",
|
|
||||||
"created":"2016-05-11T13:15:11Z",
|
|
||||||
"revised":"2016-05-11T13:22:16Z",
|
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
|
||||||
"folderId":"VzMuyEw_3WqiafcG",
|
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
|
||||||
"job":"",
|
|
||||||
"location":"template-0",
|
|
||||||
"name":"Empty Document",
|
|
||||||
"excerpt":"My test document",
|
|
||||||
"tags":"",
|
|
||||||
"template":false
|
|
||||||
},{
|
|
||||||
"id":"VzMvJEw_3WqiafcI",
|
|
||||||
"created":"2016-05-11T13:09:56Z",
|
|
||||||
"revised":"2016-05-11T13:09:56Z",
|
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
|
||||||
"folderId":"VzMuyEw_3WqiafcG",
|
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
|
||||||
"job":"0bf9b076-cb74-4e8e-75be-8ee2d24a8171",
|
|
||||||
"location":"/var/folders/d6/kr81d2fs5bsbm8rz2p092fy80000gn/T/documize/_uploads/0bf9b076-cb74-4e8e-75be-8ee2d24a8171/README.md",
|
|
||||||
"name":"README",
|
|
||||||
"excerpt":"To Document/ Instructions. GO. go- bindata- assetsfs. SSL.",
|
|
||||||
"tags":"",
|
|
||||||
"template":false
|
|
||||||
}
|
|
||||||
];
|
|
||||||
} else if (folder_id = "VzMygEw_3WrtFzto"){
|
|
||||||
return {
|
return {
|
||||||
"id":"VzMygEw_3WrtFzto",
|
"id": "VzMuyEw_3WqiafcG",
|
||||||
"created":"2016-05-11T13:24:17Z",
|
"created": "2016-05-11T15:08:24Z",
|
||||||
"revised":"2016-05-11T13:25:51Z",
|
"revised": "2016-05-11T15:08:24Z",
|
||||||
"name":"Test",
|
"name": "My Project",
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
"folderType":1
|
"folderType": 2
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/folders', function() {
|
this.get('/documents', function(db, request) {
|
||||||
return [
|
let folder_id = request.queryParams.folder;
|
||||||
{
|
|
||||||
"id":"VzMuyEw_3WqiafcG",
|
if (folder_id = "VzMuyEw_3WqiafcG") {
|
||||||
"created":"2016-05-11T15:08:24Z",
|
return [{
|
||||||
"revised":"2016-05-11T15:08:24Z",
|
"id": "VzMwX0w_3WrtFztd",
|
||||||
"name":"My Project","orgId":"VzMuyEw_3WqiafcD",
|
"created": "2016-05-11T13:15:11Z",
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
"revised": "2016-05-11T13:22:16Z",
|
||||||
"folderType":2
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
},{
|
"folderId": "VzMuyEw_3WqiafcG",
|
||||||
"id":"VzMygEw_3WrtFzto",
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
"created":"2016-05-11T13:24:17Z",
|
"job": "",
|
||||||
"revised":"2016-05-11T13:25:51Z",
|
"location": "template-0",
|
||||||
"name":"Test",
|
"name": "Empty Document",
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
"excerpt": "My test document",
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
"tags": "",
|
||||||
"folderType":1
|
"template": false
|
||||||
|
}, {
|
||||||
|
"id": "VzMvJEw_3WqiafcI",
|
||||||
|
"created": "2016-05-11T13:09:56Z",
|
||||||
|
"revised": "2016-05-11T13:09:56Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"folderId": "VzMuyEw_3WqiafcG",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"job": "0bf9b076-cb74-4e8e-75be-8ee2d24a8171",
|
||||||
|
"location": "/var/folders/d6/kr81d2fs5bsbm8rz2p092fy80000gn/T/documize/_uploads/0bf9b076-cb74-4e8e-75be-8ee2d24a8171/README.md",
|
||||||
|
"name": "README",
|
||||||
|
"excerpt": "To Document/ Instructions. GO. go- bindata- assetsfs. SSL.",
|
||||||
|
"tags": "",
|
||||||
|
"template": false
|
||||||
|
}];
|
||||||
|
} else if (folder_id = "VzMygEw_3WrtFzto") {
|
||||||
|
return {
|
||||||
|
"id": "VzMygEw_3WrtFzto",
|
||||||
|
"created": "2016-05-11T13:24:17Z",
|
||||||
|
"revised": "2016-05-11T13:25:51Z",
|
||||||
|
"name": "Test",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"folderType": 1
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
});
|
||||||
});
|
|
||||||
|
|
||||||
this.post('/public/authenticate', () => {
|
this.get('/folders', function() {
|
||||||
return {
|
return [{
|
||||||
"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0",
|
"id": "VzMuyEw_3WqiafcG",
|
||||||
"user":{
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-11T15:08:24Z",
|
||||||
|
"name": "My Project",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"folderType": 2
|
||||||
|
}, {
|
||||||
|
"id": "VzMygEw_3WrtFzto",
|
||||||
|
"created": "2016-05-11T13:24:17Z",
|
||||||
|
"revised": "2016-05-11T13:25:51Z",
|
||||||
|
"name": "Test",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"folderType": 1
|
||||||
|
}];
|
||||||
|
});
|
||||||
|
|
||||||
|
this.post('/public/authenticate', () => {
|
||||||
|
return {
|
||||||
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0",
|
||||||
|
"user": {
|
||||||
|
"id": "VzMuyEw_3WqiafcE",
|
||||||
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-11T15:08:24Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando",
|
||||||
|
"email": "brizdigital@gmail.com",
|
||||||
|
"initials": "LZ",
|
||||||
|
"active": true,
|
||||||
|
"editor": true,
|
||||||
|
"admin": true,
|
||||||
|
"accounts": [{
|
||||||
|
"id": "VzMuyEw_3WqiafcF",
|
||||||
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-11T15:08:24Z",
|
||||||
|
"admin": true,
|
||||||
|
"editor": true,
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"company": "EmberSherpa",
|
||||||
|
"title": "EmberSherpa",
|
||||||
|
"message": "This Documize instance contains all our team documentation",
|
||||||
|
"domain": ""
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/users/VzMuyEw_3WqiafcE/permissions', () => {
|
||||||
|
return [{
|
||||||
|
"folderId": "VzMuyEw_3WqiafcG",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"canView": true,
|
||||||
|
"canEdit": true
|
||||||
|
}, {
|
||||||
|
"folderId": "VzMygEw_3WrtFzto",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"canView": true,
|
||||||
|
"canEdit": true
|
||||||
|
}, {
|
||||||
|
"folderId": "VzMygEw_3WrtFzto",
|
||||||
|
"userId": "",
|
||||||
|
"canView": true,
|
||||||
|
"canEdit": false
|
||||||
|
}];
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/folders/VzMygEw_3WrtFzto', () => {
|
||||||
|
return {
|
||||||
|
"id": "VzMygEw_3WrtFzto",
|
||||||
|
"created": "2016-05-11T13:24:17Z",
|
||||||
|
"revised": "2016-05-11T13:25:51Z",
|
||||||
|
"name": "Test",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"folderType": 1
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/folders/VzMuyEw_3WqiafcG', () => {
|
||||||
|
return {
|
||||||
|
"id": "VzMuyEw_3WqiafcG",
|
||||||
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-11T15:08:24Z",
|
||||||
|
"name": "My Project",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"folderType": 2
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/folders/VzMuyEw_3WqiafcG', () => {
|
||||||
|
return {
|
||||||
|
"id": "VzMuyEw_3WqiafcG",
|
||||||
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-11T15:08:24Z",
|
||||||
|
"name": "My Project",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"folderType": 2
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/organizations/VzMuyEw_3WqiafcD', () => {
|
||||||
|
return {
|
||||||
|
"id": "VzMuyEw_3WqiafcD",
|
||||||
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-23T11:23:20Z",
|
||||||
|
"title": "EmberSherpa",
|
||||||
|
"message": "This Documize instance contains all our team documentation",
|
||||||
|
"url": "",
|
||||||
|
"domain": "",
|
||||||
|
"email": "brizdigital@gmail.com",
|
||||||
|
"allowAnonymousAccess": false
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.put('/organizations/VzMuyEw_3WqiafcD', (db, request) => {
|
||||||
|
let title = JSON.parse(request.requestBody).title;
|
||||||
|
let message = JSON.parse(request.requestBody).title;
|
||||||
|
let allowAnonymousAccess = JSON.parse(request.requestBody).allowAnonymousAccess;
|
||||||
|
|
||||||
|
return {
|
||||||
|
"id": "VzMuyEw_3WqiafcD",
|
||||||
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-23T11:23:20Z",
|
||||||
|
"title": `${title}`,
|
||||||
|
"message": `${message}`,
|
||||||
|
"url": "",
|
||||||
|
"domain": "",
|
||||||
|
"email": "brizdigital@gmail.com",
|
||||||
|
"allowAnonymousAccess": `${allowAnonymousAccess}`
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/users', () => {
|
||||||
|
return [{
|
||||||
|
"id": "VzMyp0w_3WrtFztq",
|
||||||
|
"created": "2016-05-11T13:24:55Z",
|
||||||
|
"revised": "2016-05-11T13:33:47Z",
|
||||||
|
"firstname": "Len",
|
||||||
|
"lastname": "Random",
|
||||||
|
"email": "zinyando@gmail.com",
|
||||||
|
"initials": "LR",
|
||||||
|
"active": true,
|
||||||
|
"editor": true,
|
||||||
|
"admin": false,
|
||||||
|
"accounts": [{
|
||||||
|
"id": "VzMyp0w_3WrtFztr",
|
||||||
|
"created": "2016-05-11T13:24:55Z",
|
||||||
|
"revised": "2016-05-11T13:24:55Z",
|
||||||
|
"admin": false,
|
||||||
|
"editor": true,
|
||||||
|
"userId": "VzMyp0w_3WrtFztq",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"company": "EmberSherpa",
|
||||||
|
"title": "EmberSherpa",
|
||||||
|
"message": "This Documize instance contains all our team documentation",
|
||||||
|
"domain": ""
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
"id": "VzMuyEw_3WqiafcE",
|
||||||
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-11T15:08:24Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando",
|
||||||
|
"email": "brizdigital@gmail.com",
|
||||||
|
"initials": "LZ",
|
||||||
|
"active": true,
|
||||||
|
"editor": true,
|
||||||
|
"admin": true,
|
||||||
|
"accounts": [{
|
||||||
|
"id": "VzMuyEw_3WqiafcF",
|
||||||
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-11T15:08:24Z",
|
||||||
|
"admin": true,
|
||||||
|
"editor": true,
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"company": "EmberSherpa",
|
||||||
|
"title": "EmberSherpa",
|
||||||
|
"message": "This Documize instance contains all our team documentation",
|
||||||
|
"domain": ""
|
||||||
|
}]
|
||||||
|
}];
|
||||||
|
});
|
||||||
|
|
||||||
|
this.post('/users', (db, request) => {
|
||||||
|
let firstname = JSON.parse(request.requestBody).firstname;
|
||||||
|
let lastname = JSON.parse(request.requestBody).lastname;
|
||||||
|
let email = JSON.parse(request.requestBody).email;
|
||||||
|
|
||||||
|
return {
|
||||||
|
"id":"V0RmtUw_3QeDAMW7",
|
||||||
|
"created":"2016-05-24T14:35:33Z",
|
||||||
|
"revised":"2016-05-24T14:35:33Z",
|
||||||
|
"firstname":`${firstname}`,
|
||||||
|
"lastname":`${lastname}`,
|
||||||
|
"email":`${email}`,
|
||||||
|
"initials":"TU",
|
||||||
|
"active":true,
|
||||||
|
"editor":true,
|
||||||
|
"admin":false,
|
||||||
|
"accounts":[{
|
||||||
|
"id":"V0RmtUw_3QeDAMW8",
|
||||||
|
"created":"2016-05-24T14:35:34Z",
|
||||||
|
"revised":"2016-05-24T14:35:34Z",
|
||||||
|
"admin":false,
|
||||||
|
"editor":true,
|
||||||
|
"userId":"V0RmtUw_3QeDAMW7",
|
||||||
|
"orgId":"VzMuyEw_3WqiafcD",
|
||||||
|
"company":"EmberSherpa",
|
||||||
|
"title":"EmberSherpa",
|
||||||
|
"message":"This Documize instance contains all our team documentation",
|
||||||
|
"domain":""
|
||||||
|
}
|
||||||
|
]};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/users/VzMuyEw_3WqiafcE', () => {
|
||||||
|
|
||||||
|
return {
|
||||||
"id":"VzMuyEw_3WqiafcE",
|
"id":"VzMuyEw_3WqiafcE",
|
||||||
"created":"2016-05-11T15:08:24Z",
|
"created":"2016-05-11T15:08:24Z",
|
||||||
"revised":"2016-05-11T15:08:24Z",
|
"revised":"2016-05-11T15:08:24Z",
|
||||||
|
@ -158,91 +353,63 @@ this.post('/public/authenticate', () => {
|
||||||
"active":true,
|
"active":true,
|
||||||
"editor":true,
|
"editor":true,
|
||||||
"admin":true,
|
"admin":true,
|
||||||
"accounts":[
|
"accounts":[{
|
||||||
{
|
"id":"VzMuyEw_3WqiafcF",
|
||||||
"id":"VzMuyEw_3WqiafcF",
|
"created":"2016-05-11T15:08:24Z",
|
||||||
"created":"2016-05-11T15:08:24Z",
|
"revised":"2016-05-11T15:08:24Z",
|
||||||
"revised":"2016-05-11T15:08:24Z",
|
"admin":true,
|
||||||
"admin":true,
|
"editor":true,
|
||||||
"editor":true,
|
"userId":"VzMuyEw_3WqiafcE",
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
"orgId":"VzMuyEw_3WqiafcD",
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
"company":"EmberSherpa",
|
||||||
"company":"EmberSherpa",
|
"title":"EmberSherpa",
|
||||||
"title":"EmberSherpa",
|
"message":"This Documize instance contains all our team documentation",
|
||||||
"message":"This Documize instance contains all our team documentation",
|
"domain":""
|
||||||
"domain":""
|
}
|
||||||
}
|
]};
|
||||||
]
|
});
|
||||||
}
|
|
||||||
|
this.put('/users/VzMuyEw_3WqiafcE', (db, request) => {
|
||||||
|
let firstname = JSON.parse(request.requestBody).firstname;
|
||||||
|
let lastname = JSON.parse(request.requestBody).lastname;
|
||||||
|
let email = JSON.parse(request.requestBody).email;
|
||||||
|
|
||||||
|
return {
|
||||||
|
"id":"VzMuyEw_3WqiafcE",
|
||||||
|
"created":"2016-05-11T15:08:24Z",
|
||||||
|
"revised":"2016-05-11T15:08:24Z",
|
||||||
|
"firstname":`${firstname}`,
|
||||||
|
"lastname":`${lastname}`,
|
||||||
|
"email":`${email}`,
|
||||||
|
"initials":"LZ",
|
||||||
|
"active":true,
|
||||||
|
"editor":true,
|
||||||
|
"admin":true,
|
||||||
|
"accounts":[{
|
||||||
|
"id":"VzMuyEw_3WqiafcF",
|
||||||
|
"created":"2016-05-11T15:08:24Z",
|
||||||
|
"revised":"2016-05-11T15:08:24Z",
|
||||||
|
"admin":true,
|
||||||
|
"editor":true,
|
||||||
|
"userId":"VzMuyEw_3WqiafcE",
|
||||||
|
"orgId":"VzMuyEw_3WqiafcD",
|
||||||
|
"company":"EmberSherpa",
|
||||||
|
"title":"EmberSherpa",
|
||||||
|
"message":"This Documize instance contains all our team documentation",
|
||||||
|
"domain":""
|
||||||
|
}
|
||||||
|
]};
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
very helpful for debugging
|
||||||
|
*/
|
||||||
|
this.handledRequest = function(verb, path, request) {
|
||||||
|
console.log(`👊${verb} ${path}`);
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/users/VzMuyEw_3WqiafcE/permissions', () => {
|
this.unhandledRequest = function(verb, path, request) {
|
||||||
return [
|
console.log(`🔥${verb} ${path}`);
|
||||||
{
|
|
||||||
"folderId":"VzMuyEw_3WqiafcG",
|
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
|
||||||
"canView":true,
|
|
||||||
"canEdit":true
|
|
||||||
},{
|
|
||||||
"folderId":"VzMygEw_3WrtFzto",
|
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
|
||||||
"canView":true,
|
|
||||||
"canEdit":true
|
|
||||||
},{
|
|
||||||
"folderId":"VzMygEw_3WrtFzto",
|
|
||||||
"userId":"",
|
|
||||||
"canView":true,
|
|
||||||
"canEdit":false
|
|
||||||
}
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/folders/VzMygEw_3WrtFzto', () => {
|
|
||||||
return {
|
|
||||||
"id":"VzMygEw_3WrtFzto",
|
|
||||||
"created":"2016-05-11T13:24:17Z",
|
|
||||||
"revised":"2016-05-11T13:25:51Z",
|
|
||||||
"name":"Test",
|
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
|
||||||
"folderType":1
|
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/folders/VzMuyEw_3WqiafcG', () => {
|
|
||||||
return {
|
|
||||||
"id":"VzMuyEw_3WqiafcG",
|
|
||||||
"created":"2016-05-11T15:08:24Z",
|
|
||||||
"revised":"2016-05-11T15:08:24Z",
|
|
||||||
"name":"My Project",
|
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
|
||||||
"folderType":2
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/folders/VzMuyEw_3WqiafcG', () => {
|
|
||||||
return {
|
|
||||||
"id":"VzMuyEw_3WqiafcG",
|
|
||||||
"created":"2016-05-11T15:08:24Z",
|
|
||||||
"revised":"2016-05-11T15:08:24Z",
|
|
||||||
"name":"My Project",
|
|
||||||
"orgId":"VzMuyEw_3WqiafcD",
|
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
|
||||||
"folderType":2
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
very helpful for debugging
|
|
||||||
*/
|
|
||||||
this.handledRequest = function(verb, path, request) {
|
|
||||||
console.log(`👊${verb} ${path}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.unhandledRequest = function(verb, path, request) {
|
|
||||||
console.log(`🔥${verb} ${path}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
15
app/app/mirage/factories/app-meta.js
Normal file
15
app/app/mirage/factories/app-meta.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
This is an example factory definition.
|
||||||
|
|
||||||
|
Create more files in this directory to define additional factories.
|
||||||
|
*/
|
||||||
|
import Mirage/*, {faker} */ from 'ember-cli-mirage';
|
||||||
|
|
||||||
|
export default Mirage.Factory.extend({
|
||||||
|
orgId: "VzMuyEw_3WqiafcD",
|
||||||
|
title: "EmberSherpa",
|
||||||
|
message: "This Documize instance contains all our team documentation",
|
||||||
|
url: "",
|
||||||
|
allowAnonymousAccess: false,
|
||||||
|
version: "11.2"
|
||||||
|
});
|
|
@ -4,4 +4,5 @@ export default function(/* server */) {
|
||||||
// data will not be loaded in your tests.
|
// data will not be loaded in your tests.
|
||||||
|
|
||||||
// server.createList('contact', 10);
|
// server.createList('contact', 10);
|
||||||
|
server.createList('app-meta', 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue