hecking abstractions boi
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user