renamed server/ to api/ since this is really only the api portion of the typical fc server

This commit is contained in:
shockrah
2020-08-22 15:52:37 -07:00
parent afcc03959a
commit 0822be3d20
35 changed files with 0 additions and 0 deletions

View File

View File

@@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE `invites`;

View File

@@ -0,0 +1,15 @@
-- @id : id of the invite
-- @expires : unix timestamp of when that invite expries
-- can be set to null which means it never expires
-- @uses : can be null which means it doesn't have a use limit
-- @max_uses : if this is null uses only ever incremented but we don't care for destroying on that parameter
CREATE TABLE IF NOT EXISTS `invites` (
`id` bigint UNSIGNED NOT NULL,
`expires` bigint,
`uses` integer,
`max_uses` integer,
PRIMARY KEY( `id` )
);

View File

@@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE `channels`;

View File

@@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS `channels` (
`id` BIGINT UNSIGNED NOT NULL auto_increment,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024),
`kind` INTEGER NOT NULL,
PRIMARY KEY(`id`), UNIQUE KEY(`name`)
);

View File

@@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE `sessions`;

View File

@@ -0,0 +1,8 @@
-- id's are given back to the user otherwise everything is server sided
-- NOTE: the expires column is not explicitly a date because the code required
-- to make the DATE field work with diesel is ass and looks annoying
CREATE TABLE IF NOT EXISTS `sessions` (
`secret` varchar(255) NOT NULL,
`expires` bigint UNSIGNED NOT NULL,
PRIMARY KEY(`secret`)
);

View File

@@ -0,0 +1 @@
DROP TABLE `members`;

View File

@@ -0,0 +1,11 @@
-- TODO: add rate limiter in some form
-- PERMISSIONS start at 0 and full perms => all F's
CREATE TABLE IF NOT EXISTS `members`(
`id` bigint UNSIGNED NOT NULL auto_increment,
`secret` varchar(256) NOT NULL,
`name` varchar(256) NOT NULL,
`joindate` bigint NOT NULL,
`status` integer NOT NULL,
`permissions` bigint UNSIGNED NOT NULL,
PRIMARY KEY( `id` , `secret` )
);

View File

@@ -0,0 +1 @@
DROP TABLE `messages`;

View File

@@ -0,0 +1,11 @@
-- Time stamp is _not_ in ms
CREATE TABLE IF NOT EXISTS `messages`(
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`time` BIGINT NOT NULL,
`content` VARCHAR(2048) NOT NULL,
`author_id` BIGINT UNSIGNED NOT NULL,
`channel_name` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`author_id`) REFERENCES members(`id`),
FOREIGN KEY (`channel_name`) REFERENCES channels(`name`)
);