-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17ce6e2
commit 6dc9be3
Showing
32 changed files
with
373 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# RbrightlineGithubIo | ||
|
||
## Material | ||
|
||
<a href="https://ng.ant.design/docs/introduce/en"> Material </a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"jsc": { | ||
"target": "es2017", | ||
"parser": { | ||
"syntax": "typescript", | ||
"decorators": true, | ||
"dynamicImport": true | ||
}, | ||
"transform": { | ||
"decoratorMetadata": true, | ||
"legacyDecorator": true | ||
}, | ||
"keepClassNames": true, | ||
"externalHelpers": true, | ||
"loose": true | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
}, | ||
"sourceMaps": true, | ||
"exclude": [ | ||
"jest.config.ts", | ||
".*\\.spec.tsx?$", | ||
".*\\.test.tsx?$", | ||
"./src/jest-setup.ts$", | ||
"./**/jest-setup.ts$", | ||
".*.js$" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# core | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Building | ||
|
||
Run `nx build core` to build the library. | ||
|
||
## Running unit tests | ||
|
||
Run `nx test core` to execute the unit tests via [Vitest](https://vitest.dev/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const baseConfig = require('../../eslint.config.js'); | ||
|
||
module.exports = [ | ||
...baseConfig, | ||
{ | ||
files: ['**/*.json'], | ||
rules: { | ||
'@nx/dependency-checks': [ | ||
'error', | ||
{ | ||
ignoredFiles: [ | ||
'{projectRoot}/eslint.config.{js,cjs,mjs}', | ||
'{projectRoot}/vite.config.{js,ts,mjs,mts}', | ||
], | ||
}, | ||
], | ||
}, | ||
languageOptions: { | ||
parser: require('jsonc-eslint-parser'), | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "@rline/core", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"@swc/helpers": "~0.5.11" | ||
}, | ||
"type": "commonjs", | ||
"main": "./src/index.js", | ||
"typings": "./src/index.d.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "core", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "libs/core/src", | ||
"projectType": "library", | ||
"release": { | ||
"version": { | ||
"generatorOptions": { | ||
"packageRoot": "dist/{projectRoot}", | ||
"currentVersionResolver": "git-tag" | ||
} | ||
} | ||
}, | ||
"tags": [], | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/js:swc", | ||
"outputs": ["{options.outputPath}"], | ||
"options": { | ||
"outputPath": "dist/libs/core", | ||
"main": "libs/core/src/index.ts", | ||
"tsConfig": "libs/core/tsconfig.lib.json", | ||
"assets": ["libs/core/*.md"] | ||
} | ||
}, | ||
"nx-release-publish": { | ||
"options": { | ||
"packageRoot": "dist/{projectRoot}" | ||
} | ||
}, | ||
"test": { | ||
"executor": "@nx/vite:test", | ||
"outputs": ["{options.reportsDirectory}"], | ||
"options": { | ||
"reportsDirectory": "../../coverage/libs/core" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @index(['./**/*.ts','!./**/*.{test,spec}.ts'], f => `export * from '${f.path}'`) | ||
export * from './lib/base/base.entity'; | ||
export * from './lib/query/query'; | ||
export * from './lib/transformers/query-operator'; | ||
export * from './lib/transformers/query'; | ||
export * from './lib/transformers/to-find-operator'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { | ||
Column, | ||
PrimaryGeneratedColumn, | ||
CreateDateColumn, | ||
UpdateDateColumn, | ||
DeleteDateColumn, | ||
} from 'typeorm'; | ||
|
||
export class BaseEntity { | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
} | ||
|
||
export class BaseEntityWithTimestamp extends BaseEntity { | ||
@CreateDateColumn() createdAt: Date; | ||
@UpdateDateColumn() updatedAt: Date; | ||
@DeleteDateColumn() deletedAt: Date; | ||
} | ||
|
||
export class BaseEntityWithActive extends BaseEntityWithTimestamp { | ||
@Column({ type: 'boolean', default: false }) | ||
active: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class QueryModel { | ||
@ApiProperty({ type: 'integer' }) | ||
id: number; | ||
} | ||
|
||
export class QueryModelWithTimestamp { | ||
@ApiProperty({ type: 'number' }) | ||
createdAt: Date; | ||
|
||
@ApiProperty({ type: 'number' }) | ||
updatedAt: Date; | ||
|
||
@ApiProperty({ type: 'number' }) | ||
deletedAt: Date; | ||
} | ||
|
||
export class QueryModelWithActive { | ||
@ApiProperty({ type: 'boolean' }) | ||
active: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export enum QueryOperator { | ||
EQUAL = 'eq', | ||
CONTAINS = 'cn', | ||
MORE_THAN = 'mt', | ||
LESS_THAN = 'lt', | ||
|
||
NOT_EQUAL = 'neq', | ||
NOT_CONTAINS = 'ncn', | ||
NOT_MORE_THAN = 'nmt', | ||
NOT_LESS_THAN = 'nlt', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Transform } from 'class-transformer'; | ||
|
||
export type QueryPropertyOptions = { | ||
type: PropertyType; | ||
}; | ||
export function QueryProperty(options: QueryPropertyOptions) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Equal, FindOperator, ILike, LessThan, MoreThan, Not } from 'typeorm'; | ||
import { QueryOperator } from './query-operator'; | ||
|
||
/** | ||
* | ||
* @param value query string delimeted by ":" | ||
*/ | ||
export function toFindOperator<T>( | ||
operator: QueryOperator, | ||
value: T | ||
): FindOperator<any> | undefined { | ||
switch (operator as QueryOperator) { | ||
case QueryOperator.CONTAINS: | ||
return ILike(`%${value}%`); | ||
case QueryOperator.EQUAL: | ||
return Equal(value); | ||
case QueryOperator.LESS_THAN: | ||
return LessThan(value); | ||
case QueryOperator.MORE_THAN: | ||
return MoreThan(value); | ||
case QueryOperator.NOT_CONTAINS: | ||
return Not(ILike(`%${value}%`)); | ||
case QueryOperator.NOT_EQUAL: | ||
return Not(ILike(`${value}`)); | ||
case QueryOperator.NOT_LESS_THAN: | ||
return Not(LessThan(value)); | ||
case QueryOperator.NOT_MORE_THAN: | ||
return Not(MoreThan(value)); | ||
default: | ||
return undefined; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noPropertyAccessFromIndexSignature": true | ||
}, | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.lib.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"declaration": true, | ||
"types": ["node"] | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"exclude": [ | ||
"vite.config.ts", | ||
"vite.config.mts", | ||
"vitest.config.ts", | ||
"vitest.config.mts", | ||
"src/**/*.test.ts", | ||
"src/**/*.spec.ts", | ||
"src/**/*.test.tsx", | ||
"src/**/*.spec.tsx", | ||
"src/**/*.test.js", | ||
"src/**/*.spec.js", | ||
"src/**/*.test.jsx", | ||
"src/**/*.spec.jsx" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"types": [ | ||
"vitest/globals", | ||
"vitest/importMeta", | ||
"vite/client", | ||
"node", | ||
"vitest" | ||
] | ||
}, | ||
"include": [ | ||
"vite.config.ts", | ||
"vite.config.mts", | ||
"vitest.config.ts", | ||
"vitest.config.mts", | ||
"src/**/*.test.ts", | ||
"src/**/*.spec.ts", | ||
"src/**/*.test.tsx", | ||
"src/**/*.spec.tsx", | ||
"src/**/*.test.js", | ||
"src/**/*.spec.js", | ||
"src/**/*.test.jsx", | ||
"src/**/*.spec.jsx", | ||
"src/**/*.d.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineConfig } from 'vite'; | ||
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; | ||
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'; | ||
|
||
export default defineConfig({ | ||
root: __dirname, | ||
cacheDir: '../../node_modules/.vite/libs/core', | ||
plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])], | ||
// Uncomment this if you are using workers. | ||
// worker: { | ||
// plugins: [ nxViteTsPaths() ], | ||
// }, | ||
test: { | ||
watch: false, | ||
globals: true, | ||
environment: 'node', | ||
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], | ||
reporters: ['default'], | ||
coverage: { reportsDirectory: '../../coverage/libs/core', provider: 'v8' }, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './lib/entity'; | ||
// @index(['./**/*.ts', '!./**/*.{spec,test,story,stories}.ts'], f => `export * from '${f.path}'`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { CategoryModel } from '@rline/model'; | ||
import { Exclude } from 'class-transformer'; | ||
import { MaxLength, MinLength } from 'class-validator'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
@Exclude() | ||
export class CreateCategoryDto implements CategoryModel { | ||
@ApiProperty({ type: 'string', minLength: 3, maxLength: 50, required: true }) | ||
@MinLength(3) | ||
@MaxLength(50) | ||
name: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { BaseEntity } from '@rline/core'; | ||
import { CategoryEntity } from '@rline/model'; | ||
import { Column, Entity } from 'typeorm'; | ||
|
||
@Entity() | ||
export class Category extends BaseEntity implements CategoryEntity { | ||
@Column({ type: 'varchar', unique: true }) | ||
name: string; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './lib/model'; | ||
// @index(['./**/*.ts', '!./**/*.{test,spec}.ts'], f => `export * from '${f.path}'`) | ||
export * from './lib/category/category'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Model } from '@rline/type'; | ||
|
||
export type CategoryModel = { | ||
name: string; | ||
}; | ||
|
||
export type CategoryEntity = Model<CategoryModel>; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1 @@ | ||
# type | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Building | ||
|
||
Run `nx build type` to build the library. | ||
|
||
## Running unit tests | ||
|
||
Run `nx test type` to execute the unit tests via [Vitest](https://vitest.dev/). |
Oops, something went wrong.