@things-factory/fav-base 8.0.38 → 9.0.0-9.0.0-beta.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/fav-base",
3
- "version": "8.0.38",
3
+ "version": "9.0.0-9.0.0-beta.59.0",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,7 +24,7 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create ./server/migrations/migration"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/auth-base": "^8.0.38"
27
+ "@things-factory/auth-base": "^9.0.0-9.0.0-beta.59.0"
28
28
  },
29
- "gitHead": "613db8b1fa9fd156294f113518348247ae61a2db"
29
+ "gitHead": "cf6ee84b991f469a4e71198b0e6314b45e9e10b8"
30
30
  }
package/server/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './service'
@@ -1,36 +0,0 @@
1
- import { Arg, Ctx, Mutation, Resolver } from 'type-graphql'
2
-
3
- import { getRepository } from '@things-factory/shell'
4
-
5
- import { Favorite } from './favorite'
6
- import { NewFavorite } from './favorite-type'
7
-
8
- @Resolver(Favorite)
9
- export class FavoriteMutation {
10
- @Mutation(returns => Favorite, { description: 'To create new Favorite' })
11
- async createFavorite(@Arg('favorite') favorite: NewFavorite, @Ctx() context: ResolverContext): Promise<Favorite> {
12
- const { user, domain } = context.state
13
-
14
- const repository = getRepository(Favorite)
15
-
16
- return await repository.save({
17
- domain,
18
- user,
19
- routing: favorite.routing
20
- })
21
- }
22
-
23
- @Mutation(returns => Boolean, { description: 'To delete Favorite' })
24
- async deleteFavorite(@Arg('routing') routing: string, @Ctx() context: ResolverContext): Promise<boolean> {
25
- const { domain, user } = context.state
26
- const repository = getRepository(Favorite)
27
-
28
- await repository.delete({
29
- domain: { id: domain.id },
30
- user: { id: user.id },
31
- routing
32
- })
33
-
34
- return true
35
- }
36
- }
@@ -1,41 +0,0 @@
1
- import { Arg, Args, Ctx, Query, Resolver } from 'type-graphql'
2
-
3
- import { getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
4
-
5
- import { Favorite } from './favorite'
6
- import { FavoriteList } from './favorite-type'
7
-
8
- @Resolver(Favorite)
9
- export class FavoriteQuery {
10
- @Query(returns => Favorite, { description: 'To fetch a Favorite' })
11
- async favorite(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Favorite> {
12
- const { domain } = context.state
13
-
14
- return await getRepository(Favorite).findOneBy({ domain: { id: domain.id }, id })
15
- }
16
-
17
- @Query(returns => FavoriteList, { description: 'To fetch multiple Favorites' })
18
- async favorites(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<FavoriteList> {
19
- const { domain } = context.state
20
-
21
- const queryBuilder = getQueryBuilderFromListParams({
22
- domain,
23
- params,
24
- repository: getRepository(Favorite),
25
- alias: 'favorite'
26
- })
27
-
28
- const [items, total] = await queryBuilder.getManyAndCount()
29
-
30
- return { items, total }
31
- }
32
-
33
- @Query(returns => [Favorite], { description: "To fetch current user's Favorites" })
34
- async myFavorites(@Ctx() context: ResolverContext): Promise<Favorite[]> {
35
- const { domain, user } = context.state
36
-
37
- return await getRepository(Favorite).find({
38
- where: { domain: { id: domain.id }, user: { id: user.id } }
39
- })
40
- }
41
- }
@@ -1,18 +0,0 @@
1
- import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
2
-
3
- import { Favorite } from './favorite'
4
-
5
- @InputType()
6
- export class NewFavorite {
7
- @Field()
8
- routing: string
9
- }
10
-
11
- @ObjectType()
12
- export class FavoriteList {
13
- @Field(type => [Favorite])
14
- items: Favorite[]
15
-
16
- @Field(type => Int)
17
- total: number
18
- }
@@ -1,63 +0,0 @@
1
- import {
2
- CreateDateColumn,
3
- UpdateDateColumn,
4
- Entity,
5
- Index,
6
- Column,
7
- RelationId,
8
- ManyToOne,
9
- PrimaryGeneratedColumn
10
- } from 'typeorm'
11
- import { ObjectType, Field, ID } from 'type-graphql'
12
-
13
- import { Domain } from '@things-factory/shell'
14
- import { User } from '@things-factory/auth-base'
15
-
16
- @Entity()
17
- @Index('ix_favorite_0', (favorite: Favorite) => [favorite.domain, favorite.user, favorite.routing], { unique: true })
18
- @ObjectType({ description: 'Entity for Favorite' })
19
- export class Favorite {
20
- @PrimaryGeneratedColumn('uuid')
21
- @Field(type => ID)
22
- readonly id: string
23
-
24
- @ManyToOne(type => Domain)
25
- @Field(type => Domain)
26
- domain?: Domain
27
-
28
- @RelationId((favorite: Favorite) => favorite.domain)
29
- domainId?: string
30
-
31
- @ManyToOne(type => User)
32
- @Field(type => User)
33
- user: User
34
-
35
- @RelationId((favorite: Favorite) => favorite.user)
36
- userId?: string
37
-
38
- @Column()
39
- @Field()
40
- routing: string
41
-
42
- @CreateDateColumn()
43
- @Field({ nullable: true })
44
- createdAt?: Date
45
-
46
- @UpdateDateColumn()
47
- @Field({ nullable: true })
48
- updatedAt?: Date
49
-
50
- @ManyToOne(type => User, { nullable: true })
51
- @Field(type => User, { nullable: true })
52
- creator?: User
53
-
54
- @RelationId((favorite: Favorite) => favorite.creator)
55
- creatorId?: string
56
-
57
- @ManyToOne(type => User, { nullable: true })
58
- @Field(type => User, { nullable: true })
59
- updater?: User
60
-
61
- @RelationId((favorite: Favorite) => favorite.updater)
62
- updaterId?: string
63
- }
@@ -1,6 +0,0 @@
1
- import { Favorite } from './favorite'
2
- import { FavoriteQuery } from './favorite-query'
3
- import { FavoriteMutation } from './favorite-mutation'
4
-
5
- export const entities = [Favorite]
6
- export const resolvers = [FavoriteQuery, FavoriteMutation]
@@ -1,20 +0,0 @@
1
- /* IMPORT ENTITIES AND RESOLVERS */
2
- import { entities as FavoriteEntities, resolvers as FavoriteResolvers } from './favorite'
3
-
4
- /* EXPORT ENTITY TYPES */
5
- export * from './favorite/favorite'
6
-
7
- /* EXPORT TYPES */
8
- export * from './favorite/favorite-type'
9
-
10
- export const entities = [
11
- /* ENTITIES */
12
- ...FavoriteEntities
13
- ]
14
-
15
- export const schema = {
16
- resolverClasses: [
17
- /* RESOLVER CLASSES */
18
- ...FavoriteResolvers
19
- ]
20
- }