Organize imports better

This commit is contained in:
2019-09-26 20:19:57 +02:00
parent e2bdaf6603
commit b4f707da19
11 changed files with 63 additions and 18 deletions

View File

@@ -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"

View File

@@ -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;

View File

@@ -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;

View File

@@ -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>;

View File

@@ -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>;

View File

@@ -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 => {

View File

@@ -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();