Organize imports better
This commit is contained in:
@@ -13,13 +13,12 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { db } from "@kredens/db";
|
||||
import { ApolloServer, gql } from "apollo-server-express";
|
||||
import { Kind } from "graphql/language";
|
||||
import { GraphQLScalarType, GraphQLScalarTypeConfig } from "graphql/type";
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
import { db } from "./db";
|
||||
|
||||
const typeDefs = gql`
|
||||
type Query {
|
||||
"A simple type for getting started"
|
||||
@@ -13,8 +13,12 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import {
|
||||
Extensions,
|
||||
MigrationRepository,
|
||||
UserRepository
|
||||
} from "@kredens/db/repos";
|
||||
import pgPromise, { IDatabase, IInitOptions } from "pg-promise";
|
||||
import { Extensions, MigrationRepository, UserRepository } from "./repos";
|
||||
|
||||
type ExtendedProtocol = IDatabase<Extensions> & Extensions;
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { MigrationRepository } from "./migrations";
|
||||
import { UserRepository } from "./users";
|
||||
import { MigrationRepository } from "@kredens/db/repos/migrations";
|
||||
import { UserRepository } from "@kredens/db/repos/users";
|
||||
|
||||
export interface Extensions {
|
||||
migrations: MigrationRepository;
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { Migration } from "@kredens/db/models";
|
||||
import { migrations as sql } from "@kredens/db/sql";
|
||||
import logger from "@kredens/logger";
|
||||
import { DateTime } from "luxon";
|
||||
import { IDatabase, IMain } from "pg-promise";
|
||||
import logger from "../../logger";
|
||||
import { Migration } from "../models";
|
||||
import { migrations as sql } from "../sql";
|
||||
|
||||
export class MigrationRepository {
|
||||
private db: IDatabase<any>;
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { users as sql } from "@kredens/db/sql";
|
||||
import argon2 from "argon2";
|
||||
import { Maybe, None, Some } from "monet";
|
||||
import { IDatabase, IMain } from "pg-promise";
|
||||
import { users as sql } from "../sql";
|
||||
|
||||
export class UserRepository {
|
||||
private db: IDatabase<any>;
|
||||
|
||||
10
src/index.ts
10
src/index.ts
@@ -13,16 +13,16 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { server as graphqlServer } from "@kredens/api";
|
||||
import { db } from "@kredens/db";
|
||||
import logger from "@kredens/logger";
|
||||
import authRouter from "@kredens/routes/auth";
|
||||
import indexRouter from "@kredens/routes/index";
|
||||
import cookieParser from "cookie-parser";
|
||||
import express from "express";
|
||||
import pinoExpress from "express-pino-logger";
|
||||
import helmet from "helmet";
|
||||
import createHttpError from "http-errors";
|
||||
import { db } from "./db";
|
||||
import { server as graphqlServer } from "./graphql";
|
||||
import logger from "./logger";
|
||||
import authRouter from "./routes/auth";
|
||||
import indexRouter from "./routes/index";
|
||||
|
||||
async function main() {
|
||||
await db.tx(async t => {
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { box, unbox } from "@kredens/crypto";
|
||||
import { db } from "@kredens/db";
|
||||
import express from "express";
|
||||
import createHttpError from "http-errors";
|
||||
import { DateTime } from "luxon";
|
||||
import { box, unbox } from "../crypto";
|
||||
import { db } from "../db";
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user