From b5416f5f4b5fe303f85fae7f5d9778c754925d1d Mon Sep 17 00:00:00 2001 From: "S. MohammadMahdi Zamanian" Date: Wed, 9 Oct 2024 15:42:12 +0330 Subject: [PATCH] style(*): change prettier --- .github/workflows/build.yml | 2 +- .prettierrc.yml | 6 +- .vscode/settings.json | 2 +- bun.lockb | Bin 105052 -> 105907 bytes packages/common/database/package.json | 1 + packages/common/database/src/index.ts | 61 ++++++++++++------ packages/common/schemas/src/group.ts | 8 +-- packages/common/schemas/src/index.ts | 6 +- packages/common/schemas/src/session.ts | 22 +++---- packages/common/schemas/src/user.ts | 27 ++++---- packages/common/types/src/core.ts | 16 ++--- packages/common/types/src/group.ts | 18 +++--- packages/common/types/src/index.ts | 6 +- packages/common/types/src/session.ts | 20 +++--- packages/common/types/src/user.ts | 42 ++++++------ packages/services/users/docs/auth.http | 6 ++ packages/services/users/docs/core.http | 5 ++ packages/services/users/docs/secrets.http | 6 ++ packages/services/users/package.json | 20 ++++++ packages/services/users/src/core.ts | 49 ++++++++++++++ packages/services/users/src/index.ts | 27 ++++++++ .../services/users/src/routes/auth/user.ts | 3 + .../users/src/routes/secrets/get-all-users.ts | 7 ++ packages/services/users/tsconfig.json | 7 ++ 24 files changed, 260 insertions(+), 107 deletions(-) create mode 100644 packages/services/users/docs/auth.http create mode 100644 packages/services/users/docs/core.http create mode 100644 packages/services/users/docs/secrets.http create mode 100644 packages/services/users/package.json create mode 100644 packages/services/users/src/core.ts create mode 100644 packages/services/users/src/index.ts create mode 100644 packages/services/users/src/routes/auth/user.ts create mode 100644 packages/services/users/src/routes/secrets/get-all-users.ts create mode 100644 packages/services/users/tsconfig.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94aeb7a..db063b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: uses: oven-sh/setup-bun@v1 - name: 🛒 Install Dependencies 🛒 - run: bun install + run: bun install --frozen-lockfile - name: 🔨 Build Project 🔨 run: bun run build:test diff --git a/.prettierrc.yml b/.prettierrc.yml index 8b6b788..9871b6f 100644 --- a/.prettierrc.yml +++ b/.prettierrc.yml @@ -1,8 +1,8 @@ -semi: false +semi: true singleQuote: true trailingComma: all arrowParens: always -printWidth: 120 +printWidth: 100 tabWidth: 2 useTabs: false endOfLine: lf @@ -10,7 +10,7 @@ quoteProps: as-needed jsxSingleQuote: false insertPragma: false requirePragma: false -proseWrap: preserve +proseWrap: always htmlWhitespaceSensitivity: ignore overrides: - files: '*.json' diff --git a/.vscode/settings.json b/.vscode/settings.json index fb5774e..85bb348 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "cSpell.words": ["gecut", "Jsonify", "Jsonize", "promeet", "Virtuals", "Zamanian"] + "cSpell.words": ["gecut", "hono", "Jsonify", "Jsonize", "promeet", "Virtuals", "Zamanian"] } diff --git a/bun.lockb b/bun.lockb index 2f5c6a8bc20974f27bae2908e2b93771f2a364e9..6d0d4d53567bd389facfe01a5aa36cb3df752629 100755 GIT binary patch delta 15799 zcmeHOdt6n;_TO`016xEz!6O`=DuyC&@PG&hd<(u`kX`d0wrbhnd~}`Tg_zeA*w@`OaFiW@gQr zH8Xo}W`DfJt9FOi!npR~Id5cb&;Ik87b7=TPOQBU{^iKVv8$e&zk1V)?{#?2bLPx8 z&oPBAZBc%Bwad$36lG$0S*goa33OFf7Q4zDBg0=&+&7>a0CZK96i=vBl=Gg75(WM! zFbw#L#7tld@QZ;q;OAb75&~RjK~un|ycMM>@FK7g@Ka!uMb}%jo{j=R5EKHfz=1$& zFc#Phs5asqSeSMNg^2x<4`T7v^BOCPFSt;tG}c*BISH1QyCzo@kF8Rg`x(~!2MASn zd=sPf_rOyvezIIsm_$~OuZXR3mX;{a@^KTL|b ztlXt2<4Vd#J4-5*Dex6_(^UZnLVk%yTCCNFnkz~$q^|<0PnSImGbWc8$BwUn(T80&zx`9|w{JKO&^aOJl1XAic5JP;YF>s7mVKtQp53Ib|iKadosw^kI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j7d>`f3*6>V`KXTzRIvMJ#}x*S?PhX@I5_L1Bg;giZfqh>*;Ut-$Xipq-muI&lDsqci?l2pLd;L(Ctloiad3KN2aF;kDJ28r(;qo( ztdm%ph3(7yL_a*F|A=uD-|q&!^dtwJEqjQgWazg~Nnxxb&Yg4>2z)}EkE7r{*)a6) zXH;{+=_hv^ds1xAM)Y0~7XWti)BmAkzPkC-0@wF?{L^TvONCQ|J@an>{D-IBc{t$t z*YpACM;|82HJlr7YGSp<2C@k8E%fpJs9_EuUwC@~%7m7~mf|4%0fhF8J@hw4z9Zqe zJyu_y^cifW7$?$tjsM`0!qBsOFzouzp4nN(lS74ANQZmS} zm;B=j&h3baewG{}Tu`X*yLhoD^2T^-`vaGaCnZ)XSZ`R+pKfeyzR06t-x`E8Jnq)? zLa2X#^wNeNtTgG2{k9KB>2v_THMVK2N*p5xwu>(T_I-VggXqG}BOZ<4oYmFB?oY*R zr6y$tik5wDt6=8QJW&P(He1XYz-(KG^=1ByRg01RaOhf}E2j5j6D)7$iZlIK^NbU@ z#vdFUKi+c0i09PcFq%j`px>Yd2Y%ng&|Ik^As79de?$>#drdTd zJM#qPfbo2>NZbtt%lZCdRxTc%7Krt^$kVZ+j-*@j#Lv0vCefRs85_zTEK0}{0kAay!-2440>V* z0*Xi2uDF94@v@tLd~v4jr$0SzIoG$n@%)Z?(j%GA=82;SXomU68LRRy&N=OP?g4a> zf#+o0WOf$nFHe0NPL-`X5juA%EYLj?7XE`S2IaAmHox@&w&@)LEHvrQ^i5(xfAL`+ z>y3?j%D5_B60+>k@jGj>w$ZD$Mwp+g4_+#``|p#MUqLP1v3s8hxwvHXSWzGb4P;u> zdp!-cxtSSnu^AyZ_DaJCs>SmIS@qTt`7FAh7{giY)^m?BPoS9h7)ub-o@C|0IVJ9K XRh6A5mzR{dD@2b1W*66~vy& diff --git a/packages/common/database/package.json b/packages/common/database/package.json index a930fb5..25ac81a 100644 --- a/packages/common/database/package.json +++ b/packages/common/database/package.json @@ -2,6 +2,7 @@ "name": "@promeet/database", "private": true, "type": "module", + "main": "./src/index.ts", "dependencies": { "@promeet/schemas": "workspace:^", "@promeet/types": "workspace:^", diff --git a/packages/common/database/src/index.ts b/packages/common/database/src/index.ts index 2b86fd5..2ae84ce 100644 --- a/packages/common/database/src/index.ts +++ b/packages/common/database/src/index.ts @@ -1,8 +1,8 @@ -import { GecutLogger } from '@gecut/logger' -import { $GroupSchema, $SessionSchema, $UserSchema } from '@promeet/schemas' -import mongoose from 'mongoose' +import { GecutLogger } from '@gecut/logger'; +import { $GroupSchema, $SessionSchema, $UserSchema } from '@promeet/schemas'; +import mongoose from 'mongoose'; -import type { GroupInterface, SessionInterface, UserInterface } from '@promeet/types' +import type { GroupInterface, SessionInterface, UserInterface } from '@promeet/types'; export class Database { constructor( @@ -14,40 +14,48 @@ export class Database { dbName: 'test', ...(this.options ?? {}), - } + }; } - $user = mongoose.model('user', $UserSchema) - $group = mongoose.model('group', $GroupSchema) - $session = mongoose.model('session', $SessionSchema) + $user = mongoose.model('user', $UserSchema); + $group = mongoose.model('group', $GroupSchema); + $session = mongoose.model('session', $SessionSchema); - connector?: typeof mongoose + connector?: typeof mongoose; async connect() { if (this.uri.startsWith('mongodb://') || this.uri.startsWith('mongodb+srv://')) { - this.logger.method?.('connect') + this.logger.method?.('connect'); try { - return (this.connector = await mongoose.connect(this.uri, this.options)) + return (this.connector = await mongoose.connect(this.uri, this.options)); } catch (error) { - return this.logger.error('connect', 'connect_failed', error) + return this.logger.error('connect', 'connect_failed', error); } } - this.logger.error('connect', 'uri_not_valid', { uri: this.uri, options: this.options }) + this.logger.error('connect', 'uri_not_valid', { uri: this.uri, options: this.options }); - return null + return null; } async initialize() { - if (this.connector == null) return -1 + if (this.connector == null) return -1; + + let total = await this.totalDocuments(); + + if (total.user + total.group + total.session < 1) { + await this.$user.db.dropDatabase(); + + await this.createDefaults(); - const total = await this.totalDocuments() + total = await this.totalDocuments(); + } - this.logger.methodFull?.('initialize', '', total) + this.logger.methodFull?.('initialize', '', total); - return total + return total; } private async totalDocuments() { @@ -55,8 +63,21 @@ export class Database { this.$user.countDocuments(), this.$group.countDocuments(), this.$session.countDocuments(), - ]) + ]); + + return { user, group, session }; + } + + private async createDefaults() { + const [user] = await Promise.all([ + this.$user.create({ + firstName: 'سید محمدمهدی', + lastName: 'زمانیان', + phoneNumber: '09155595488', + email: 'dev@mm25zamanian.ir', + }), + ]); - return { user, group, session } + return { user }; } } diff --git a/packages/common/schemas/src/group.ts b/packages/common/schemas/src/group.ts index bad9bad..f9897e7 100644 --- a/packages/common/schemas/src/group.ts +++ b/packages/common/schemas/src/group.ts @@ -1,4 +1,4 @@ -import { Schema, Types } from 'mongoose' +import { Schema, Types } from 'mongoose'; import type { GroupInterface, @@ -7,9 +7,9 @@ import type { GroupInterfaceStatics, GroupInterfaceInstanceMethods, GroupInterfaceQueryHelpers, -} from '@promeet/types' +} from '@promeet/types'; -const hour = 1000 * 60 * 60 +const hour = 1000 * 60 * 60; export const $GroupSchema = new Schema< GroupInterface, @@ -35,4 +35,4 @@ export const $GroupSchema = new Schema< { timestamps: true, }, -) +); diff --git a/packages/common/schemas/src/index.ts b/packages/common/schemas/src/index.ts index 2af9b77..c7cc888 100644 --- a/packages/common/schemas/src/index.ts +++ b/packages/common/schemas/src/index.ts @@ -1,3 +1,3 @@ -export * from './group' -export * from './user' -export * from './session' +export * from './group'; +export * from './user'; +export * from './session'; diff --git a/packages/common/schemas/src/session.ts b/packages/common/schemas/src/session.ts index 2708ccb..1c8da82 100644 --- a/packages/common/schemas/src/session.ts +++ b/packages/common/schemas/src/session.ts @@ -1,4 +1,4 @@ -import { Schema, Types } from 'mongoose' +import { Schema, Types } from 'mongoose'; import type { SessionInterface, @@ -7,7 +7,7 @@ import type { SessionInterfaceStatics, SessionInterfaceInstanceMethods, SessionInterfaceQueryHelpers, -} from '@promeet/types' +} from '@promeet/types'; export const $SessionSchema = new Schema< SessionInterface, @@ -21,11 +21,11 @@ export const $SessionSchema = new Schema< startedAt: { type: Date, default: () => { - const now = new Date() + const now = new Date(); - now.setHours(18) + now.setHours(18); - return now + return now; }, }, length: { @@ -39,20 +39,20 @@ export const $SessionSchema = new Schema< timestamps: true, methods: { async makeFromGroup(startDate) { - const _this = await this.populate('group') + const _this = await this.populate('group'); - this.startedAt = new Date(startDate + _this.group.defaultSessionStartedAt) - this.length = _this.group.defaultSessionLength + this.startedAt = new Date(startDate + _this.group.defaultSessionStartedAt); + this.length = _this.group.defaultSessionLength; - return await this.save() + return await this.save(); }, }, virtuals: { endedAt: { get() { - return new Date(this.startedAt.getTime() + this.length) + return new Date(this.startedAt.getTime() + this.length); }, }, }, }, -) +); diff --git a/packages/common/schemas/src/user.ts b/packages/common/schemas/src/user.ts index aff749b..cea1992 100644 --- a/packages/common/schemas/src/user.ts +++ b/packages/common/schemas/src/user.ts @@ -1,6 +1,6 @@ -import { randomNumber } from '@gecut/utilities/data-types/number.js' -import { uid } from '@gecut/utilities/uid.js' -import { Schema } from 'mongoose' +import { randomNumber } from '@gecut/utilities/data-types/number.js'; +import { uid } from '@gecut/utilities/uid.js'; +import { Schema } from 'mongoose'; import type { UserInterface, @@ -9,7 +9,7 @@ import type { UserInterfaceStatics, UserInterfaceInstanceMethods, UserInterfaceQueryHelpers, -} from '@promeet/types' +} from '@promeet/types'; export const $UserSchema = new Schema< UserInterface, @@ -48,31 +48,32 @@ export const $UserSchema = new Schema< timestamps: true, methods: { makeToken() { - this.token = uid() + this.token = uid(); - this.save() + this.save(); - return this.token + return this.token; }, makeOTP() { - if (this.otp?.code == null || Date.now() > new Date(this.otp.expiredAt).getTime()) delete this.otp + if (this.otp?.code == null || Date.now() > new Date(this.otp.expiredAt).getTime()) + delete this.otp; this.otp = { code: randomNumber(999999, 111111).toString(), expiredAt: new Date(Date.now() + 300000), - } + }; - this.save() + this.save(); - return this.otp.code + return this.otp.code; }, }, virtuals: { fullName: { get() { - return this.firstName + ' ' + this.lastName + return this.firstName + ' ' + this.lastName; }, }, }, }, -) +); diff --git a/packages/common/types/src/core.ts b/packages/common/types/src/core.ts index d7f00b2..704969c 100644 --- a/packages/common/types/src/core.ts +++ b/packages/common/types/src/core.ts @@ -1,14 +1,14 @@ -import type { ArrayValues, Jsonify } from '@gecut/types' -import type { Types, Document } from 'mongoose' +import type { ArrayValues, Jsonify } from '@gecut/types'; +import type { Types, Document } from 'mongoose'; -export const Models = ['user', 'group', 'session'] as const -export type ModelsType = ArrayValues +export const Models = ['user', 'group', 'session'] as const; +export type ModelsType = ArrayValues; export interface Entity extends Document { - _id: Types.ObjectId + _id: Types.ObjectId; - disabled?: boolean - createdAt: Date + disabled?: boolean; + createdAt: Date; } -export type Jsonize = Jsonify & { _id: string }> +export type Jsonize = Jsonify & { _id: string }>; diff --git a/packages/common/types/src/group.ts b/packages/common/types/src/group.ts index 210ee08..0ef7d8c 100644 --- a/packages/common/types/src/group.ts +++ b/packages/common/types/src/group.ts @@ -1,13 +1,13 @@ -import type { Entity, Jsonize } from './core' -import type { UserInterface } from './user' -import type { Model } from 'mongoose' +import type { Entity, Jsonize } from './core'; +import type { UserInterface } from './user'; +import type { Model } from 'mongoose'; export interface GroupInterface extends Entity { - teachers: UserInterface[] - students: UserInterface[] + teachers: UserInterface[]; + students: UserInterface[]; - defaultSessionStartedAt: number - defaultSessionLength: number + defaultSessionStartedAt: number; + defaultSessionLength: number; } export interface GroupInterfaceQueryHelpers {} @@ -20,6 +20,6 @@ export type GroupModel = Model< GroupInterfaceQueryHelpers, GroupInterfaceInstanceMethods, GroupInterfaceVirtuals -> +>; -export type GroupData = Jsonize +export type GroupData = Jsonize; diff --git a/packages/common/types/src/index.ts b/packages/common/types/src/index.ts index 2af9b77..c7cc888 100644 --- a/packages/common/types/src/index.ts +++ b/packages/common/types/src/index.ts @@ -1,3 +1,3 @@ -export * from './group' -export * from './user' -export * from './session' +export * from './group'; +export * from './user'; +export * from './session'; diff --git a/packages/common/types/src/session.ts b/packages/common/types/src/session.ts index 0e2c717..eba31e2 100644 --- a/packages/common/types/src/session.ts +++ b/packages/common/types/src/session.ts @@ -1,20 +1,20 @@ -import type { Entity, Jsonize } from './core' -import type { GroupInterface } from './group' -import type { Model } from 'mongoose' +import type { Entity, Jsonize } from './core'; +import type { GroupInterface } from './group'; +import type { Model } from 'mongoose'; export interface SessionInterface extends Entity { - startedAt: Date - length: number + startedAt: Date; + length: number; - group: GroupInterface + group: GroupInterface; } export interface SessionInterfaceQueryHelpers {} export interface SessionInterfaceInstanceMethods { - makeFromGroup(startDate: number): Promise + makeFromGroup(startDate: number): Promise; } export interface SessionInterfaceVirtuals { - readonly endedAt: Date + readonly endedAt: Date; } export interface SessionInterfaceStatics {} @@ -23,6 +23,6 @@ export type SessionModel = Model< SessionInterfaceQueryHelpers, SessionInterfaceInstanceMethods, SessionInterfaceVirtuals -> +>; -export type SessionData = Jsonize +export type SessionData = Jsonize; diff --git a/packages/common/types/src/user.ts b/packages/common/types/src/user.ts index 5e522cb..e651a36 100644 --- a/packages/common/types/src/user.ts +++ b/packages/common/types/src/user.ts @@ -1,42 +1,42 @@ -import type { Entity, Jsonize, ModelsType } from './core' -import type { PartialDeep } from '@gecut/types' -import type { Model } from 'mongoose' +import type { Entity, Jsonize, ModelsType } from './core'; +import type { PartialDeep } from '@gecut/types'; +import type { Model } from 'mongoose'; export interface OTPInterface { - code: string - expiredAt: Date + code: string; + expiredAt: Date; } export interface UserInterface extends Entity { - firstName: string - lastName: string - phoneNumber: string - email?: string + firstName: string; + lastName: string; + phoneNumber: string; + email?: string; - token: string + token: string; - otp?: OTPInterface + otp?: OTPInterface; permissions: PartialDeep< Record< ModelsType, { - read: boolean - create: boolean - update: boolean - delete: boolean + read: boolean; + create: boolean; + update: boolean; + delete: boolean; } > - > + >; } export interface UserInterfaceQueryHelpers {} export interface UserInterfaceInstanceMethods { - makeOTP(): string - makeToken(): string + makeOTP(): string; + makeToken(): string; } export interface UserInterfaceVirtuals { - readonly fullName: string + readonly fullName: string; } export interface UserInterfaceStatics {} @@ -45,6 +45,6 @@ export type UserModel = Model< UserInterfaceQueryHelpers, UserInterfaceInstanceMethods, UserInterfaceVirtuals -> +>; -export type UserData = Jsonize +export type UserData = Jsonize; diff --git a/packages/services/users/docs/auth.http b/packages/services/users/docs/auth.http new file mode 100644 index 0000000..521a92c --- /dev/null +++ b/packages/services/users/docs/auth.http @@ -0,0 +1,6 @@ +@hostname = 0.0.0.0 +@port = 3130 +@host = {{hostname}}:{{port}} + +GET http://{{host}}/auth/user HTTP/1.1 +Authorization: Bearer m20fkdt20-jdbx5xbcew diff --git a/packages/services/users/docs/core.http b/packages/services/users/docs/core.http new file mode 100644 index 0000000..ca39d7d --- /dev/null +++ b/packages/services/users/docs/core.http @@ -0,0 +1,5 @@ +@hostname = 0.0.0.0 +@port = 3130 +@host = {{hostname}}:{{port}} + +GET http://{{host}}/ HTTP/1.1 diff --git a/packages/services/users/docs/secrets.http b/packages/services/users/docs/secrets.http new file mode 100644 index 0000000..1da1615 --- /dev/null +++ b/packages/services/users/docs/secrets.http @@ -0,0 +1,6 @@ +@hostname = 0.0.0.0 +@port = 3131 +@host = {{hostname}}:{{port}} + +GET http://{{host}}/secrets/get.all.users HTTP/1.1 +Authorization: Bearer null diff --git a/packages/services/users/package.json b/packages/services/users/package.json new file mode 100644 index 0000000..eb569a6 --- /dev/null +++ b/packages/services/users/package.json @@ -0,0 +1,20 @@ +{ + "name": "users", + "scripts": { + "dev": "bun run --hot src/index.ts", + "build": "bun build ./src/index.ts", + "build:all": "bun build ./src/**.ts" + }, + "dependencies": { + "hono": "^4.6.3" + }, + "devDependencies": { + "@gecut/logger": "^2.0.0", + "@gecut/types": "^3.0.0", + "@gecut/utilities": "^6.0.0", + "@promeet/database": "workspace:*", + "@promeet/schemas": "workspace:*", + "@promeet/types": "workspace:*", + "@types/bun": "latest" + } +} diff --git a/packages/services/users/src/core.ts b/packages/services/users/src/core.ts new file mode 100644 index 0000000..c7e3f20 --- /dev/null +++ b/packages/services/users/src/core.ts @@ -0,0 +1,49 @@ +import { env } from '@gecut/utilities/env.js'; +import { Database } from '@promeet/database'; +import { Hono } from 'hono'; +import { bearerAuth } from 'hono/bearer-auth'; +import { logger } from 'hono/logger'; + +import type { UserData } from '@promeet/types'; + +export const $exHono = new Hono<{ Variables: { user: UserData } }>(); +export const $inHono = new Hono(); +export const db = new Database( + 'mongodb://root:m9zpx6DSV8Y1jNJFOlOaJuQHbAK63BTL@3c9eb54a-69d7-43bd-a87d-3478585093bc.hsvc.ir:30242/', + undefined, + { + appName: 'users-services', + }, +); + +export const config = { + host: env('HOST', '0.0.0.0', 'string'), + port: env('PORT', 3130, 'number'), + + secret: { + host: env('SECRET_HOST', '0.0.0.0', 'string'), + port: env('SECRET_PORT', 3131, 'number'), + token: env('SECRET_TOKEN', 'null', 'string'), + }, +}; + +$exHono.use(logger()); +$inHono.use(logger()); + +$inHono.use('/secrets/*', bearerAuth({ token: config.secret.token })); + +$exHono.use( + '/auth/*', + bearerAuth({ + verifyToken: async (token, c) => { + const user: UserData | null = await db.$user.findOne({ token }); + + c.set('user', user); + + return user != null; + }, + }), +); + +$exHono.all('/', (c) => c.redirect('/health')); +$exHono.get('/health', (c) => c.text('OK!', 200)); diff --git a/packages/services/users/src/index.ts b/packages/services/users/src/index.ts new file mode 100644 index 0000000..6c3cd58 --- /dev/null +++ b/packages/services/users/src/index.ts @@ -0,0 +1,27 @@ +import { $exHono, $inHono, config, db } from './core'; +import './routes/auth/user'; +import './routes/secrets/get-all-users'; + +db.connect() + .then(() => db.initialize()) + .then(() => { + const externalServer = Bun.serve({ + fetch: $exHono.fetch, + port: config.port, + hostname: config.host, + }); + + const internalServer = Bun.serve({ + fetch: $inHono.fetch, + port: config.secret.port, + hostname: config.secret.host, + }); + + console.log('externalServer', { + url: externalServer.url.toString(), + }); + + console.log('internalServer', { + url: internalServer.url.toString(), + }); + }); diff --git a/packages/services/users/src/routes/auth/user.ts b/packages/services/users/src/routes/auth/user.ts new file mode 100644 index 0000000..0663a7d --- /dev/null +++ b/packages/services/users/src/routes/auth/user.ts @@ -0,0 +1,3 @@ +import { $exHono } from '../../core'; + +$exHono.get('/auth/user', async (c) => c.json(c.get('user'))); diff --git a/packages/services/users/src/routes/secrets/get-all-users.ts b/packages/services/users/src/routes/secrets/get-all-users.ts new file mode 100644 index 0000000..3adc7bc --- /dev/null +++ b/packages/services/users/src/routes/secrets/get-all-users.ts @@ -0,0 +1,7 @@ +import { $inHono, db } from '../../core'; + +$inHono.get('/secrets/get.all.users', async (c) => { + const users = await db.$user.find({}).exec(); + + return c.json(users); +}); diff --git a/packages/services/users/tsconfig.json b/packages/services/users/tsconfig.json new file mode 100644 index 0000000..9136c14 --- /dev/null +++ b/packages/services/users/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "strict": true, + "jsx": "react-jsx", + "jsxImportSource": "hono/jsx" + } +}