@things-factory/code-base 4.0.0-y.0 → 4.0.5

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.
@@ -26,3 +26,29 @@ export const getCodeByName = async function (name) {
26
26
  return []
27
27
  }
28
28
  }
29
+
30
+ export const getPartnerCodeByName = async function (name, partnerDomainId) {
31
+ if (!name || !partnerDomainId) throw new Error('parameter is undefined')
32
+
33
+ const response = await client.query({
34
+ query: gql`
35
+ query partnerCommonCode($name: String!, $partnerDomainId: String!) {
36
+ partnerCommonCode(name: $name, partnerDomainId: $partnerDomainId) {
37
+ details {
38
+ rank
39
+ name
40
+ description
41
+ }
42
+ }
43
+ }
44
+ `,
45
+ variables: { name, partnerDomainId },
46
+ context: gqlContext()
47
+ })
48
+
49
+ if (!response.errors && response.data.partnerCommonCode && response.data.partnerCommonCode.details) {
50
+ return response.data.partnerCommonCode.details.sort((a, b) => a.rank - b.rank)
51
+ } else {
52
+ return []
53
+ }
54
+ }
@@ -21,6 +21,12 @@ exports.Query = {
21
21
  .leftJoinAndSelect('CommonCode.updater', 'Updater')
22
22
  .getManyAndCount();
23
23
  return { items, total };
24
+ },
25
+ async partnerCommonCode(_, { name, partnerDomainId }, context) {
26
+ return await (0, typeorm_1.getRepository)(entities_1.CommonCode).findOne({
27
+ where: { domain: partnerDomainId, name },
28
+ relations: ['details', 'domain', 'creator', 'updater']
29
+ });
24
30
  }
25
31
  };
26
32
  exports.CommonCode = {
@@ -1 +1 @@
1
- {"version":3,"file":"common-code-query.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/common-code/common-code-query.ts"],"names":[],"mappings":";;;AAAA,iDAA6D;AAC7D,qCAAuC;AACvC,gDAAoF;AAEvE,QAAA,KAAK,GAAG;IACnB,KAAK,CAAC,UAAU,CAAC,CAAM,EAAE,EAAE,IAAI,EAAE,EAAE,OAAY;QAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,uBAAa,EAAC,qBAAgB,CAAC,CAAC,OAAO,CAAC;YACnD,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;YACvB,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;SAC5C,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QACvD,MAAM,YAAY,GAAG,IAAA,uBAAa,EAAC,qBAAgB,CAAC,CAAC,kBAAkB,EAAE,CAAA;QACzE,IAAA,kBAAU,EAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QAEzC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,YAAY;aACtC,iBAAiB,CAAC,mBAAmB,EAAE,QAAQ,CAAC;aAChD,iBAAiB,CAAC,oBAAoB,EAAE,SAAS,CAAC;aAClD,iBAAiB,CAAC,oBAAoB,EAAE,SAAS,CAAC;aAClD,eAAe,EAAE,CAAA;QAEpB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;CACF,CAAA;AAEY,QAAA,UAAU,GAAG;IACxB,KAAK,CAAC,OAAO,CAAC,UAAU;QACtB,OAAO,MAAM,IAAA,uBAAa,EAAC,2BAAgB,CAAC,CAAC,IAAI,CAAC;YAChD,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"common-code-query.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/common-code/common-code-query.ts"],"names":[],"mappings":";;;AAAA,iDAA6D;AAC7D,qCAAuC;AACvC,gDAAoF;AAEvE,QAAA,KAAK,GAAG;IACnB,KAAK,CAAC,UAAU,CAAC,CAAM,EAAE,EAAE,IAAI,EAAE,EAAE,OAAY;QAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,uBAAa,EA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ql_tag_1.default) `
31
31
  extend type Query {
32
32
  commonCodes(filters: [Filter], pagination: Pagination, sortings: [Sorting]): CommonCodeList
33
33
  commonCode(name: String!): CommonCode
34
+ partnerCommonCode(name: String!, partnerDomainId: String!): CommonCode
34
35
  }
35
36
  `;
36
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/common-code/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA6B;AAE7B,gDAA6B;AAC7B,qDAAkC;AAClC,sDAAmC;AACnC,oDAAiC;AAEpB,QAAA,kBAAkB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;CAapC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/common-code/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA6B;AAE7B,gDAA6B;AAC7B,qDAAkC;AAClC,sDAAmC;AACnC,oDAAiC;AAEpB,QAAA,kBAAkB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;CAcpC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/code-base",
3
- "version": "4.0.0-y.0",
3
+ "version": "4.0.5",
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 -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/auth-base": "^4.0.0-y.0"
27
+ "@things-factory/auth-base": "^4.0.5"
28
28
  },
29
- "gitHead": "64ee0f6547f90b1386024b975efc3b31a5e381cb"
29
+ "gitHead": "b7b2976818dceab74a34903499d408eed5d45b04"
30
30
  }
@@ -23,6 +23,13 @@ export const Query = {
23
23
  .getManyAndCount()
24
24
 
25
25
  return { items, total }
26
+ },
27
+
28
+ async partnerCommonCode(_: any, { name, partnerDomainId }, context: any) {
29
+ return await getRepository(CommonCodeEntity).findOne({
30
+ where: { domain: partnerDomainId, name },
31
+ relations: ['details', 'domain', 'creator', 'updater']
32
+ })
26
33
  }
27
34
  }
28
35
 
@@ -17,5 +17,6 @@ export const CommonCodeResolver = gql`
17
17
  extend type Query {
18
18
  commonCodes(filters: [Filter], pagination: Pagination, sortings: [Sorting]): CommonCodeList
19
19
  commonCode(name: String!): CommonCode
20
+ partnerCommonCode(name: String!, partnerDomainId: String!): CommonCode
20
21
  }
21
22
  `