This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Field, ID, ObjectType, Int } from 'type-graphql' | |
import { UserGQL } from './User' | |
import { Prisma, PrismaClient, Post, prisma } from '@prisma/client' | |
import { plainToInstance } from 'class-transformer' | |
import { prismaClient } from './../../prisma/prismaClient' | |
type Constructor<T> = { | |
new (): T | |
relations: Record<keyof Prisma.PostInclude, Function> | |
baseRelations: Record<keyof Prisma.PostInclude, Function> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path' | |
import fs from 'fs' | |
const jestSpecTemplate = ({ | |
moduleName, | |
fnName, | |
args | |
}: { | |
moduleName: string | |
fnName: string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[INFO] 19:02:10 Restarting: /home/capaj/work-repos/interview-tests/KrakenFiatPaymentsTest/src/fiatWorker.ts has been modified | |
Deposited for Jadzia Dax: count=6 sum=3160.73 USD | |
Deposited for James T. Kirk: count=5 sum=2087.89 USD | |
Deposited for Jean-Luc Picard: count=3 sum=1573.55 USD | |
Deposited for Jonathan Archer: count=7 sum=3763.39 USD | |
Deposited for Leonard McCoy: count=3 sum=839.65 USD | |
Deposited for Montgomery Scott: count=4 sum=2360.65 USD | |
Deposited for Spock: count=10 sum=5312.81 USD | |
Deposited for Wesley Crusher: count=3 sum=1694.19 USD | |
Deposited without known user: count=4 sum=1786.67 USD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import moment from 'moment-timezone' | |
export const shiftUtcDayTimeToTimezone = ( | |
utcDayTime: string, | |
timezone: string | |
) => { | |
const offsetMinutes = moment.tz(moment.utc(), timezone).utcOffset() | |
const [hours, minutes] = utcDayTime.split(':') | |
const quotient = Math.floor(offsetMinutes / 60) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import moment from 'moment-timezone' | |
export const shiftUtcDayTimeToTimezone = ( | |
utcDayTime: string, | |
timezone: string | |
) => { | |
const offsetMinutes = moment.tz(moment.utc(), timezone).utcOffset() | |
const [hours, minutes] = utcDayTime.split(':') | |
const quotient = Math.floor(offsetMinutes / 60) | |
const remainder = offsetMinutes % 60 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git init | |
npm init | |
adds gitignore with node_modules | |
creates a file index.ts and index.spec.ts | |
creates tsconfig.json | |
runs be-pretty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Schema() | |
class SuperSchema { | |
@Query({type: [PropertyModel]}) | |
async allProperties(first: number, filter: FilterInput): Promise<PropertyModel[]> { | |
const query = PropertyModel.query() | |
if (filter) { | |
query.where('appraisedValue', '<', filter.appraisedValue.lessThan) | |
} | |
if (first) { query.limit(first) } | |
return query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 info it worked if it ends with ok | |
1 verbose cli [ '/home/capaj/.nvm/versions/node/v8.11.4/bin/node', | |
1 verbose cli '/home/capaj/.nvm/versions/node/v8.11.4/bin/npm', | |
1 verbose cli 'link' ] | |
2 info using [email protected] | |
3 info using [email protected] | |
4 verbose linkPkg /home/capaj/git_projects/graphql-repos/apollo-server/packages/apollo-server-express | |
5 verbose link build target /home/capaj/.nvm/versions/node/v8.11.4/lib/node_modules/apollo-server-express | |
6 verbose npm-session 8c25d9a6a55659ed | |
7 silly install runPreinstallTopLevelLifecycles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import traverse from 'traverse' | |
const findGetters = obj => { | |
const getters = [] | |
traverse(obj).forEach(function (x) { | |
if (this.isRoot) { | |
return | |
} | |
const descriptor = Object.getOwnPropertyDescriptor( | |
this.parent.node, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { shellSync } = require('execa') | |
const config = require('../../src/config/config') | |
const { password, username } = config.databases.sql | |
const dbName = 'my_db_name' // this DB will get migrated | |
const dumpFileName = 'my_db_dump.sql' | |
const shellSyncWithStdio = shCommand => | |
shellSync(shCommand, { stdio: 'inherit' }) | |
shellSyncWithStdio( |