hecking abstractions boi

This commit is contained in:
Ben
2018-09-15 11:58:52 +01:00
parent f9a93d61ab
commit d72127bf2b
4 changed files with 35 additions and 9 deletions

View File

@@ -95,7 +95,10 @@ export class BaseDatabase {
primaryKey: true,
unique: true
},
content: Sequelize.TEXT,
content: {
type: Sequelize.TEXT,
allowNull: true
},
parentgroup: {
type: Sequelize.BIGINT,
allowNull: true

View File

@@ -3,11 +3,33 @@ import {Database} from '../database/database';
export class Notes extends Groups {
static async newNote(id, content, creatorid, order) {
Database.notes.newNote(id, null, )
}
static async genID() {
return new Date().getTime();
}
static async genEndpoint() {
const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let endpoint;
while (true) {
endpoint = 'N';
for (let i = 0; i < 7; i++)
endpoint += possible[Math.floor(Math.random() * possible.length)];
if (await Database.notes.getNoteByEndpoint(endpoint) == -1)
break;
}
return endpoint;
}
static async getNoteByEndpoint(endpoint) {
}
static async makeNotePerma(id, endpoint) {

View File

@@ -10,7 +10,7 @@ export class PermaLink {
let endpoint;
while (true) {
endpoint = 'N';
endpoint = 'P';
for (let i = 0; i < 7; i++)
endpoint += possible[Math.floor(Math.random() * possible.length)];