ztechno_core 0.0.46 → 0.0.48

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.
@@ -12,6 +12,16 @@ export declare class ZUserService {
12
12
  register({ email, pass, role, admin }: ZRequiredUserColumns): Promise<{
13
13
  session: string;
14
14
  }>;
15
+ fetch(opt?: { limit: number }): Promise<any[]>;
16
+ exists(
17
+ opt:
18
+ | {
19
+ email: string;
20
+ }
21
+ | {
22
+ user_id: number;
23
+ },
24
+ ): Promise<boolean>;
15
25
  find(
16
26
  opt:
17
27
  | {
@@ -59,6 +59,20 @@ class ZUserService {
59
59
  );
60
60
  return { session };
61
61
  }
62
+ async fetch(opt) {
63
+ const rows = await this.sqlService.query(
64
+ `
65
+ SELECT user_id, email, role, admin, created_at FROM \`${this.tableName}\`
66
+ LIMIT ?
67
+ `,
68
+ [opt.limit],
69
+ );
70
+ return rows;
71
+ }
72
+ async exists(opt) {
73
+ const user = await this.find(opt);
74
+ return user !== undefined;
75
+ }
62
76
  async find(opt) {
63
77
  if (opt.email !== undefined) {
64
78
  const rows = await this.sqlService.query(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztechno_core",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "description": "Core files for ztechno framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",