Files
outline/server/test/support.js
Tom Moor 52765d9d1d Document Viewers (#79)
* Recording document views

* Add 'views' to document response

* Basic displaying of document views, probably want it more sublte than this? But hey, lets get it in there

* Bigly improves. RESTful > RPC

* Display of who's viewed doc

* Add Popover, add Scrollable, move views store

* Working server tests 💁

* Document Stars (#81)

* Added: Starred documents

* UI is dumb but functionality works

* Star now displayed inline in title

* Optimistic rendering

* Documents Endpoints (#85)

* More seeds, documents.list endpoint

* Upgrade deprecated middleware

* document.viewers, specs

* Add documents.starred
Add request specs for star / unstar endpoints

* Basic /starred page

* Remove comment

* Fixed double layout
2017-06-25 17:21:33 -07:00

68 lines
1.6 KiB
JavaScript

// @flow
import { User, Document, Collection, Team } from '../models';
import { sequelize } from '../sequelize';
export function flushdb() {
const sql = sequelize.getQueryInterface();
const tables = Object.keys(sequelize.models).map(model =>
sql.quoteTable(sequelize.models[model].getTableName())
);
const query = `TRUNCATE ${tables.join(', ')} CASCADE`;
return sequelize.query(query);
}
const seed = async () => {
const team = await Team.create({
id: '86fde1d4-0050-428f-9f0b-0bf77f8bdf61',
name: 'Team',
slackId: 'T2399UF2P',
slackData: {
id: 'T2399UF2P',
},
});
const user = await User.create({
id: '86fde1d4-0050-428f-9f0b-0bf77f8bdf61',
email: 'user1@example.com',
username: 'user1',
name: 'User 1',
password: 'test123!',
teamId: team.id,
slackId: 'U2399UF2P',
slackData: {
id: 'U2399UF2P',
image_192: 'http://example.com/avatar.png',
},
});
const collection = await Collection.create({
id: '86fde1d4-0050-428f-9f0b-0bf77f8bdf61',
name: 'Collection',
urlId: 'collection',
teamId: team.id,
creatorId: user.id,
type: 'atlas',
});
const document = await Document.create({
parentDocumentId: null,
atlasId: collection.id,
teamId: collection.teamId,
userId: collection.creatorId,
lastModifiedById: collection.creatorId,
createdById: collection.creatorId,
title: 'Introduction',
text: '# Introduction\n\nLets get started...',
});
return {
user,
collection,
document,
team,
};
};
export { seed, sequelize };