Skip to content

Commit

Permalink
Changed everything to tabs instead of spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
FOSSforlife committed Apr 19, 2020
1 parent efb0557 commit 294cb4a
Show file tree
Hide file tree
Showing 17 changed files with 497 additions and 497 deletions.
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import * as dotenv from 'dotenv';
import * as path from 'path';

export function loadConfig() {
delete process.env.NODE_ENV;
dotenv.config({ path: path.join(__dirname, '../.env') });
delete process.env.NODE_ENV;
dotenv.config({ path: path.join(__dirname, '../.env') });
}
16 changes: 8 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import { Logger } from '../src/logger';
import { getServer } from './server';

async function bootstrap() {
await loadConfig();
await loadConfig();

const server = getServer();
await server.start();
const server = getServer();
await server.start();
}

bootstrap().catch((error: Error) => {
Logger.error(error);
if (error.stack) {
Logger.error(error.stack.split('\n'));
}
process.exit(1);
Logger.error(error);
if (error.stack) {
Logger.error(error.stack.split('\n'));
}
process.exit(1);
});
2 changes: 1 addition & 1 deletion src/interfaces/account-settings.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export interface AccountSettings {
itemsPerPage: number;
itemsPerPage: number;
}
56 changes: 28 additions & 28 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@ import * as util from 'util';
import { getBindingError } from 'warthog';

export class Logger {
static info(...args: any[]) {
args = args.length === 1 ? args[0] : args;
console.log(util.inspect(args, { showHidden: false, depth: null }));
}

static error(...args: any[]) {
args = args.length === 1 ? args[0] : args;
console.error(util.inspect(args, { showHidden: false, depth: null }));
}

// static debug(...args: any[]) {
// console.debug(args);
// }

static log(...args: any[]) {
console.log(args);
}

static warn(...args: any[]) {
console.warn(args);
}

// This takes a raw GraphQL error and pulls out the relevant info
static logGraphQLError(error: Error) {
console.error(
util.inspect(getBindingError(error), { showHidden: false, depth: null })
);
}
static info(...args: any[]) {
args = args.length === 1 ? args[0] : args;
console.log(util.inspect(args, { showHidden: false, depth: null }));
}

static error(...args: any[]) {
args = args.length === 1 ? args[0] : args;
console.error(util.inspect(args, { showHidden: false, depth: null }));
}

// static debug(...args: any[]) {
// console.debug(args);
// }

static log(...args: any[]) {
console.log(args);
}

static warn(...args: any[]) {
console.warn(args);
}

// This takes a raw GraphQL error and pulls out the relevant info
static logGraphQLError(error: Error) {
console.error(
util.inspect(getBindingError(error), { showHidden: false, depth: null })
);
}
}
/* eslint-enable no-console */
98 changes: 49 additions & 49 deletions src/modules/collection-item/collection-item.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,53 @@ import { Review } from '../review/review.model';

@Model()
export class CollectionItem extends BaseModel {
@StringField({ nullable: true })
customTitle?: string;

@StringField({ nullable: true })
customArtist?: string;

@ManyToOne(() => User, (user: User) => user.collection)
user!: User;

@ManyToOne(() => Item, (item: Item) => item.collectionItem)
itemDetails!: Item;

@IntField({ nullable: true, default: 0 })
plays?: number;

// needs to be nullable for writes
// FIXME: This is calling the database even though apiOnly is true
// (Only occurs for mutation collectionItems, not collectionItem)
// TODO: The other problem seems to be that this.itemDetails doesn't exist by the time the resolver responds
// @StringField({ apiOnly: true, nullable: true })
// get artist(): string {
// return this.itemDetails.artist;
// }

// these fields are not required for the field resolvers to work
// however they may be required to make fields nullable
// @StringField({ apiOnly: true, nullable: true })
// get title(): string {
// return this.itemDetails.title;
// }

@StringField({ apiOnly: true, nullable: true })
get mbid(): string | undefined {
return this.itemDetails.mbid;
}

@OneToMany(() => Review, (review: Review) => review.collectionItem)
reviews?: Review[];

// FIXME: warthog codegen fails when using optional chaining
// @StringField({ apiOnly: true, nullable: true })
// get rating(): string | undefined {
// return this.reviews?.pop()?.rating; // TODO: Do we need the second question mark?
// }

// @StringField({ apiOnly: true, nullable: true })
// get review(): string | undefined {
// return this.reviews?.pop()?.reviewText;
// }
@StringField({ nullable: true })
customTitle?: string;

@StringField({ nullable: true })
customArtist?: string;

@ManyToOne(() => User, (user: User) => user.collection)
user!: User;

@ManyToOne(() => Item, (item: Item) => item.collectionItem)
itemDetails!: Item;

@IntField({ nullable: true, default: 0 })
plays?: number;

// needs to be nullable for writes
// FIXME: This is calling the database even though apiOnly is true
// (Only occurs for mutation collectionItems, not collectionItem)
// TODO: The other problem seems to be that this.itemDetails doesn't exist by the time the resolver responds
// @StringField({ apiOnly: true, nullable: true })
// get artist(): string {
// return this.itemDetails.artist;
// }

// these fields are not required for the field resolvers to work
// however they may be required to make fields nullable
// @StringField({ apiOnly: true, nullable: true })
// get title(): string {
// return this.itemDetails.title;
// }

@StringField({ apiOnly: true, nullable: true })
get mbid(): string | undefined {
return this.itemDetails.mbid;
}

@OneToMany(() => Review, (review: Review) => review.collectionItem)
reviews?: Review[];

// FIXME: warthog codegen fails when using optional chaining
// @StringField({ apiOnly: true, nullable: true })
// get rating(): string | undefined {
// return this.reviews?.pop()?.rating; // TODO: Do we need the second question mark?
// }

// @StringField({ apiOnly: true, nullable: true })
// get review(): string | undefined {
// return this.reviews?.pop()?.reviewText;
// }
}
Loading

0 comments on commit 294cb4a

Please sign in to comment.