Skip to content
Permalink
Browse files

remove artifacts of warthog.sqlite.tmp

  • Loading branch information
goldcaddy77 committed Mar 16, 2020
1 parent c571bd9 commit 58f13076cbbd621e4e94a9ab4a8acd4fcf14f6d6
Showing with 649 additions and 173 deletions.
  1. +2 −1 .circleci/config.yml
  2. +5 −1 examples/03-one-to-many-relationship/src/post.model.ts
  3. +4 −1 examples/03-one-to-many-relationship/src/user.model.ts
  4. +4 −1 examples/04-many-to-many-relationship/src/join-with-metadata/role.model.ts
  5. +8 −2 examples/04-many-to-many-relationship/src/join-with-metadata/user-role.model.ts
  6. +3 −3 examples/04-many-to-many-relationship/src/join-with-metadata/user-role.resolver.ts
  7. +4 −1 examples/04-many-to-many-relationship/src/join-with-metadata/user.model.ts
  8. +4 −1 examples/04-many-to-many-relationship/src/simple-join-table/author.model.ts
  9. +4 −1 examples/04-many-to-many-relationship/src/simple-join-table/post.model.ts
  10. +16 −6 examples/07-feature-flags/src/environment/environment.model.ts
  11. +3 −3 examples/07-feature-flags/src/environment/environment.resolver.ts
  12. +32 −16 examples/07-feature-flags/src/feature-flag-segment/feature-flag-segment.model.ts
  13. +4 −7 examples/07-feature-flags/src/feature-flag-segment/feature-flag-segment.resolver.ts
  14. +32 −16 examples/07-feature-flags/src/feature-flag-user/feature-flag-user.model.ts
  15. +4 −7 examples/07-feature-flags/src/feature-flag-user/feature-flag-user.resolver.ts
  16. +8 −4 examples/07-feature-flags/src/feature-flag/feature-flag.model.ts
  17. +3 −3 examples/07-feature-flags/src/feature-flag/feature-flag.resolver.ts
  18. +20 −5 examples/07-feature-flags/src/project/project.model.ts
  19. +20 −9 examples/07-feature-flags/src/segment/segment.model.ts
  20. +32 −16 examples/07-feature-flags/src/user-segment/user-segment.model.ts
  21. +3 −3 examples/07-feature-flags/src/user-segment/user-segment.resolver.ts
  22. +8 −2 examples/07-feature-flags/src/user/user.model.ts
  23. +5 −1 examples/08-performance/src/modules/post/post.model.ts
  24. +4 −1 examples/08-performance/src/modules/user/user.model.ts
  25. +5 −1 examples/09-production/src/modules/post/post.model.ts
  26. +4 −1 examples/09-production/src/modules/user/user.model.ts
  27. +2 −3 package.json
  28. +0 −3 src/cli/commands/codegen.ts
  29. +2 −1 src/core/config.ts
  30. +0 −18 src/db/helpers.ts
  31. +0 −1 src/db/index.ts
  32. +4 −1 src/decorators/ForeignKeyField.ts
  33. +173 −0 src/test/functional/__snapshots__/server.test.ts.snap
  34. +26 −14 src/test/functional/cli.test.ts
  35. +101 −0 src/test/functional/fixtures.ts
  36. +15 −7 src/test/functional/server.test.ts
  37. +10 −0 src/test/generated/binding.ts
  38. +16 −0 src/test/generated/classes.ts
  39. +12 −0 src/test/generated/schema.graphql
  40. +27 −0 src/test/helpers.ts
  41. +7 −3 src/test/modules/dish/dish.model.ts
  42. +8 −5 src/test/modules/kitchen-sink/kitchen-sink.model.ts
  43. +1 −1 src/test/server-vars.ts
  44. +2 −1 src/test/setupFilesAfterEnv.ts
  45. +1 −1 tsconfig.json
  46. +1 −1 tsconfig.test.json
@@ -42,8 +42,9 @@ jobs:
- run:
name: test
command: |
yarn test:db:drop
yarn test:db:create
yarn test:ci
NODE_ENV=test yarn jest --verbose --coverage --ci --detectOpenHandles --runInBand
- codecov/upload:
file: coverage/*.json
flags: backend
@@ -7,6 +7,10 @@ export class Post extends BaseModel {
@StringField()
title?: string;

@ManyToOne(() => User, user => user.posts, { nullable: false })
@ManyToOne(
() => User,
user => user.posts,
{ nullable: false }
)
user?: User;
}
@@ -7,6 +7,9 @@ export class User extends BaseModel {
@StringField()
firstName?: string;

@OneToMany(() => Post, post => post.user)
@OneToMany(
() => Post,
post => post.user
)
posts?: Post[];
}
@@ -7,6 +7,9 @@ export class Role extends BaseModel {
@StringField()
name?: string;

@OneToMany(() => UserRole, userRole => userRole.role)
@OneToMany(
() => UserRole,
userRole => userRole.role
)
userRoles?: UserRole[];
}
@@ -8,10 +8,16 @@ import { User } from './user.model';
// a lightweight join table with the foreign keys
@Model()
export class UserRole extends BaseModel {
@ManyToOne(() => User, user => user.userRoles)
@ManyToOne(
() => User,
user => user.userRoles
)
user?: User;

@ManyToOne(() => Role, role => role.userRoles)
@ManyToOne(
() => Role,
role => role.userRoles
)
role?: Role;

@StringField({ nullable: true })
@@ -32,9 +32,9 @@ export class UserRoleResolver extends BaseResolver<UserRole> {
}

@Query(() => [UserRole])
async userRoles(@Args() { where, orderBy, limit, offset }: UserRoleWhereArgs): Promise<
UserRole[]
> {
async userRoles(
@Args() { where, orderBy, limit, offset }: UserRoleWhereArgs
): Promise<UserRole[]> {
return this.find<UserRoleWhereInput>(where, orderBy, limit, offset);
}

@@ -7,6 +7,9 @@ export class User extends BaseModel {
@StringField()
firstName?: string;

@OneToMany(() => UserRole, userRole => userRole.user)
@OneToMany(
() => UserRole,
userRole => userRole.user
)
userRoles?: UserRole[];
}
@@ -7,6 +7,9 @@ export class Author extends BaseModel {
@StringField()
firstName?: string;

@OneToMany(() => Post, post => post.user)
@OneToMany(
() => Post,
post => post.user
)
posts?: Post[];
}
@@ -7,6 +7,9 @@ export class Post extends BaseModel {
@StringField()
name?: string;

@OneToMany(() => Author, author => author.role)
@OneToMany(
() => Author,
author => author.role
)
authors?: Author[];
}
@@ -22,13 +22,20 @@ export class Environment extends BaseModel {
// TODO: this should not be nullable
// TODO: this should not be exposed through the GraphQL either
// TODO: should create "ManyToOneByKey" to join tables by a non-ID key
@ManyToOne(() => Project, (project: Project) => project.environments, {
skipGraphQLField: true,
nullable: true
})
@ManyToOne(
() => Project,
(project: Project) => project.environments,
{
skipGraphQLField: true,
nullable: true
}
)
project?: Project;

@OneToMany(() => Segment, (segment: Segment) => segment.environment)
@OneToMany(
() => Segment,
(segment: Segment) => segment.environment
)
segments?: Environment[];

@OneToMany(
@@ -43,6 +50,9 @@ export class Environment extends BaseModel {
)
featureFlagSegments?: FeatureFlagSegment[];

@OneToMany(() => UserSegment, (userSegments: UserSegment) => userSegments.environment)
@OneToMany(
() => UserSegment,
(userSegments: UserSegment) => userSegments.environment
)
userSegments?: UserSegment[];
}
@@ -56,9 +56,9 @@ export class EnvironmentResolver {
}

@Query(() => [Environment])
async environments(@Args() { where, orderBy, limit, offset }: EnvironmentWhereArgs): Promise<
Environment[]
> {
async environments(
@Args() { where, orderBy, limit, offset }: EnvironmentWhereArgs
): Promise<Environment[]> {
return this.service.find<EnvironmentWhereInput>(where, orderBy, limit, offset);
}

@@ -10,36 +10,52 @@ export class FeatureFlagSegment extends BaseModel {
@StringField({ maxLength: 20, minLength: 3, nullable: false })
projKey: string;

@ManyToOne(() => Project, (project: Project) => project.featureFlagSegments, {
nullable: true,
skipGraphQLField: true
})
@ManyToOne(
() => Project,
(project: Project) => project.featureFlagSegments,
{
nullable: true,
skipGraphQLField: true
}
)
project?: Project;

@StringField({ maxLength: 20, minLength: 3, nullable: false })
envKey: string;

@ManyToOne(() => Environment, (environment: Environment) => environment.featureFlagSegments, {
nullable: true,
skipGraphQLField: true
})
@ManyToOne(
() => Environment,
(environment: Environment) => environment.featureFlagSegments,
{
nullable: true,
skipGraphQLField: true
}
)
environment?: Environment;

@StringField({ maxLength: 20, minLength: 3, nullable: false })
featureKey: string;

@ManyToOne(() => FeatureFlag, (featureFlag: FeatureFlag) => featureFlag.featureFlagSegments, {
nullable: true,
skipGraphQLField: true
})
@ManyToOne(
() => FeatureFlag,
(featureFlag: FeatureFlag) => featureFlag.featureFlagSegments,
{
nullable: true,
skipGraphQLField: true
}
)
featureFlag?: FeatureFlag;

@StringField({ maxLength: 20, minLength: 3, nullable: false })
segmentKey: string;

@ManyToOne(() => Segment, (segment: Segment) => segment.featureFlagSegments, {
nullable: true,
skipGraphQLField: true
})
@ManyToOne(
() => Segment,
(segment: Segment) => segment.featureFlagSegments,
{
nullable: true,
skipGraphQLField: true
}
)
segment?: Segment;
}
@@ -20,13 +20,10 @@ export class FeatureFlagSegmentResolver {
}

@Query(() => [FeatureFlagSegment])
async featureFlagSegments(@Args()
{
where,
orderBy,
limit,
offset
}: FeatureFlagSegmentWhereArgs): Promise<FeatureFlagSegment[]> {
async featureFlagSegments(
@Args()
{ where, orderBy, limit, offset }: FeatureFlagSegmentWhereArgs
): Promise<FeatureFlagSegment[]> {
return this.service.find<FeatureFlagSegmentWhereInput>(where, orderBy, limit, offset);
}

@@ -10,36 +10,52 @@ export class FeatureFlagUser extends BaseModel {
@StringField({ maxLength: 20, minLength: 3, nullable: false })
featureKey: string;

@ManyToOne(() => FeatureFlag, (featureFlag: FeatureFlag) => featureFlag.featureFlagUsers, {
nullable: true,
skipGraphQLField: true
})
@ManyToOne(
() => FeatureFlag,
(featureFlag: FeatureFlag) => featureFlag.featureFlagUsers,
{
nullable: true,
skipGraphQLField: true
}
)
featureFlag?: FeatureFlag;

@StringField({ maxLength: 20, minLength: 3, nullable: false })
userKey: string;

@ManyToOne(() => User, (user: User) => user.featureFlagUsers, {
skipGraphQLField: true,
nullable: true
})
@ManyToOne(
() => User,
(user: User) => user.featureFlagUsers,
{
skipGraphQLField: true,
nullable: true
}
)
user?: User;

@StringField({ maxLength: 20, minLength: 3, nullable: false })
projKey: string;

@ManyToOne(() => Project, (project: Project) => project.featureFlagUsers, {
skipGraphQLField: true,
nullable: true
})
@ManyToOne(
() => Project,
(project: Project) => project.featureFlagUsers,
{
skipGraphQLField: true,
nullable: true
}
)
project?: Project;

@StringField({ maxLength: 20, minLength: 3, nullable: false })
envKey: string;

@ManyToOne(() => Environment, (environment: Environment) => environment.featureFlagUsers, {
nullable: true,
skipGraphQLField: true
})
@ManyToOne(
() => Environment,
(environment: Environment) => environment.featureFlagUsers,
{
nullable: true,
skipGraphQLField: true
}
)
environment?: Environment;
}
@@ -27,13 +27,10 @@ export class FeatureFlagUserResolver {
}

@Query(() => [FeatureFlagUser])
async featureFlagUsers(@Args()
{
where,
orderBy,
limit,
offset
}: FeatureFlagUserWhereArgs): Promise<FeatureFlagUser[]> {
async featureFlagUsers(
@Args()
{ where, orderBy, limit, offset }: FeatureFlagUserWhereArgs
): Promise<FeatureFlagUser[]> {
return this.service.find<FeatureFlagUserWhereInput>(where, orderBy, limit, offset);
}

@@ -19,10 +19,14 @@ export class FeatureFlag extends BaseModel {
// TODO: this should not be nullable
// TODO: this should not be exposed through the GraphQL either
// TODO: should create "ManyToOneByKey" to join tables by a non-ID key
@ManyToOne(() => Project, (project: Project) => project.featureFlags, {
skipGraphQLField: true,
nullable: true
})
@ManyToOne(
() => Project,
(project: Project) => project.featureFlags,
{
skipGraphQLField: true,
nullable: true
}
)
project?: Project;

@OneToMany(
@@ -66,9 +66,9 @@ export class FeatureFlagResolver {
}

@Query(() => [FeatureFlag])
async featureFlags(@Args() { where, orderBy, limit, offset }: FeatureFlagWhereArgs): Promise<
FeatureFlag[]
> {
async featureFlags(
@Args() { where, orderBy, limit, offset }: FeatureFlagWhereArgs
): Promise<FeatureFlag[]> {
return this.service.find<FeatureFlagWhereInput>(where, orderBy, limit, offset);
}

0 comments on commit 58f1307

Please sign in to comment.
You can’t perform that action at this time.