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
This commit is contained in:
Tom Moor
2017-06-25 17:21:33 -07:00
committed by GitHub
parent 1fa473b271
commit 52765d9d1d
66 changed files with 1629 additions and 460 deletions

View File

@@ -21,9 +21,7 @@ function runMigrations() {
path: './server/migrations',
},
});
return umzug.up().then(() => {
return sequelize.close();
});
return umzug.up();
}
runMigrations();

View File

@@ -1,4 +1,5 @@
import { User } from '../models';
// @flow
import { User, Document, Collection, Team } from '../models';
import { sequelize } from '../sequelize';
export function flushdb() {
@@ -6,23 +7,61 @@ export function flushdb() {
const tables = Object.keys(sequelize.models).map(model =>
sql.quoteTable(sequelize.models[model].getTableName())
);
const query = `TRUNCATE ${tables.join(', ')} CASCADE`;
const query = `TRUNCATE ${tables.join(', ')} CASCADE`;
return sequelize.query(query);
}
const seed = async () => {
await User.create({
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!',
slackId: '123',
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 };