Initial homepage and feed up and running

This commit is contained in:
2022-03-29 12:59:31 -05:00
parent 0c01712341
commit 2a8571d6dd
38 changed files with 864 additions and 47 deletions

View File

@@ -0,0 +1,58 @@
import {DatabaseService, FieldType, Inject, Injectable, Migration} from '@extollo/lib'
/**
* CreateWorkItemsTableMigration
* ----------------------------------
* Create the work_items table to track project history.
*/
@Injectable()
export default class CreateWorkItemsTableMigration extends Migration {
@Inject()
protected readonly db!: DatabaseService
/**
* Apply the migration.
*/
async up(): Promise<void> {
const schema = this.db.get().schema()
const table = await schema.table('work_items')
table.primaryKey('work_item_id').required()
table.column('visible')
.type(FieldType.bool)
.required()
.default(false)
table.column('name')
.type(FieldType.varchar)
.required()
table.column('description')
.type(FieldType.text)
.required()
.default('')
table.column('start_date')
.type(FieldType.timestamp)
.required()
table.column('end_date')
.type(FieldType.timestamp)
.nullable()
await schema.commit(table)
}
/**
* Undo the migration.
*/
async down(): Promise<void> {
const schema = this.db.get().schema()
const table = await schema.table('work_items')
table.dropIfExists()
await schema.commit(table)
}
}

View File

@@ -0,0 +1,58 @@
import {DatabaseService, FieldType, Inject, Injectable, Migration, raw} from '@extollo/lib'
/**
* CreateFeedPostsTableMigration
* ----------------------------------
* Create the table to hold posts to the "updates" feed.
*/
@Injectable()
export default class CreateFeedPostsTableMigration extends Migration {
@Inject()
protected readonly db!: DatabaseService
/**
* Apply the migration.
*/
async up(): Promise<void> {
const schema = this.db.get().schema()
const table = await schema.table('feed_posts')
table.primaryKey('feed_post_id', FieldType.varchar)
.required()
// date, tag, text, visible
table.column('posted_at')
.type(FieldType.timestamp)
.default(raw('NOW()'))
.required()
table.column('tag')
.type(FieldType.varchar)
.required()
table.column('visible')
.type(FieldType.bool)
.default(false)
.required()
table.column('body')
.type(FieldType.text)
.default('')
.required()
await schema.commit(table)
}
/**
* Undo the migration.
*/
async down(): Promise<void> {
const schema = this.db.get().schema()
const table = await schema.table('feed_posts')
table.dropIfExists()
await schema.commit(table)
}
}