Fix Style Issues

pull/4/head
Trivernis 5 years ago
parent 5440cca701
commit 8f3b50a4ce

@ -6,6 +6,7 @@ import * as express from "express";
import {Request, Response} from "express";
import * as graphqlHTTP from "express-graphql";
import * as session from "express-session";
import sharedsession = require("express-socket.io-session");
import * as fsx from "fs-extra";
import {buildSchema} from "graphql";
import {importSchema} from "graphql-import";
@ -24,7 +25,6 @@ import dataaccess from "./lib/dataAccess";
import globals from "./lib/globals";
import HomeRoute from "./routes/HomeRoute";
import {UploadRoute} from "./routes/UploadRoute";
import sharedsession = require("express-socket.io-session");
const SequelizeStore = require("connect-session-sequelize")(session.Store);
const createLimiter: (...args: any) => any = require("express-limiter");

@ -254,10 +254,12 @@ export function resolver(req: any, res: any): any {
},
async deletePost({postId}: { postId: number }) {
if (postId) {
const post = await models.Post.findByPk(postId, {include: [{
const post = await models.Post.findByPk(postId, {
include: [{
as: "rAuthor",
model: models.User,
}]});
}],
});
const isAdmin = (await models.User.findOne({where: {id: req.session.userId}})).isAdmin;
if (post.rAuthor.id === req.session.userId || isAdmin) {
try {

@ -2,6 +2,7 @@ process.env.NODE_CONFIG_DIR = __dirname + "/../config";
// tslint:disable:no-console
import * as cluster from "cluster";
import App from "./app";
const numCPUs = require("os").cpus().length;
if (cluster.isMaster) {

@ -14,8 +14,8 @@ import {NoActionSpecifiedError} from "./errors/NoActionSpecifiedError";
import {UserNotFoundError} from "./errors/UserNotFoundError";
import globals from "./globals";
import {InternalEvents} from "./InternalEvents";
import {Activity} from "./models";
import * as models from "./models";
import {Activity} from "./models";
// tslint:disable:completed-docs
@ -263,8 +263,10 @@ namespace dataaccess {
export async function createRequest(sender: number, receiver: number, requestType?: RequestType) {
requestType = requestType || RequestType.FRIENDREQUEST;
const requestExists = !!await models.Request.findOne({where:
{senderId: sender, receiverId: receiver, requestType}});
const requestExists = !!await models.Request.findOne({
where:
{senderId: sender, receiverId: receiver, requestType},
});
if (!requestExists) {
const request = await models.Request.create({senderId: sender, receiverId: receiver, requestType});

Loading…
Cancel
Save