repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
Hatulak/rest-epidemics-news-service
src/users/user.model.ts
<gh_stars>0 import * as mongoose from 'mongoose'; export enum UserRole { ADMIN = 'ADMIN', EDITOR = 'EDITOR', NORMAL = 'NORMAL', } export const UserSchema = new mongoose.Schema({ username: { type: String, unique: true, required: true }, password: { type: String, required: true }, salt: { type: String, requ...
Hatulak/rest-epidemics-news-service
src/comments/dto/get-comment-filter.dto.ts
<gh_stars>0 import { IsOptional } from 'class-validator'; export class GetCommentsFilterDto { @IsOptional() search: string; @IsOptional() author: string; @IsOptional() nconst: string; @IsOptional() newsId: string; @IsOptional() date: Date; @IsOptional() dateAfter: Date; @IsOptional() dateBe...
Hatulak/rest-epidemics-news-service
src/app.module.ts
<reponame>Hatulak/rest-epidemics-news-service import { Module } from '@nestjs/common'; import { NewsModule } from './news/news.module'; import { MongooseModule } from '@nestjs/mongoose'; import { CategoriesModule } from './categories/categories.module'; import { CommentsModule } from './comments/comments.module'; impor...
Hatulak/rest-epidemics-news-service
src/categories/categories.controller.ts
import { Controller, Get, Param, Post, UsePipes, ValidationPipe, Body, Put, Delete, UseGuards, } from '@nestjs/common'; import { CategoriesService } from './categories.service'; import { UpdateCategoryDto } from './dto/update-category.dto'; import { CreateCategoryDto } from './dto/create-category.dt...
Hatulak/rest-epidemics-news-service
src/news/dto/update-news.dto.ts
import { IsNotEmpty, IsOptional, IsIn } from 'class-validator'; import { NewsStatus } from '../news.model'; export class UpdateNewsDto { @IsNotEmpty() id: string; @IsOptional() title: string; @IsOptional() description: string; @IsOptional() @IsIn([NewsStatus.CREATED, NewsStatus.PUBLISHED]) status: New...
Hatulak/rest-epidemics-news-service
src/categories/categories.service.ts
import { Injectable, NotFoundException } from '@nestjs/common'; import { Category } from './category.model'; import { InjectModel } from '@nestjs/mongoose'; import { Model } from 'mongoose'; import { CreateCategoryDto } from './dto/create-category.dto'; import { v4 as uuid } from 'uuid'; import { UpdateCategoryDto } fr...
Hatulak/rest-epidemics-news-service
src/users/users.controller.ts
<filename>src/users/users.controller.ts import { Controller, Body, Post, UnauthorizedException, UseGuards, UsePipes, ValidationPipe, Delete, Get, Param, } from '@nestjs/common'; import { UsersService } from './users.service'; import { CreateUserDto } from './dto/create-user.dto'; import { User, User...
Hatulak/rest-epidemics-news-service
src/auth/auth.service.ts
import { Injectable } from '@nestjs/common'; import { UsersService } from 'src/users/users.service'; import { JwtService } from '@nestjs/jwt'; import { LoginUserDto } from 'src/users/dto/login-user.dto'; import { User } from 'src/users/user.model'; import * as bcrypt from 'bcrypt'; @Injectable() export class AuthServi...
Hatulak/rest-epidemics-news-service
src/comments/dto/create-comment.dto.ts
import { IsNotEmpty, IsOptional } from 'class-validator'; export class CreateCommentDto { @IsNotEmpty() details: string; @IsOptional() newsId: string; @IsOptional() nconst: string; }
Hatulak/rest-epidemics-news-service
src/users/users.service.ts
<reponame>Hatulak/rest-epidemics-news-service import { Injectable, ConflictException, InternalServerErrorException, NotFoundException, BadRequestException, } from '@nestjs/common'; import { User, UserRole } from './user.model'; import { InjectModel } from '@nestjs/mongoose'; import { Model } from 'mongoose'; ...
Hatulak/rest-epidemics-news-service
src/news/dto/create-news.dto.ts
import { IsNotEmpty, IsOptional } from 'class-validator'; export class CreateNewsDto { @IsNotEmpty() title: string; @IsNotEmpty() description: string; @IsOptional() cconst: string; @IsOptional() categoryId: string; }
Hatulak/rest-epidemics-news-service
src/users/dto/set-user-role.dto.ts
import { IsNotEmpty, IsIn } from 'class-validator'; import { UserRole } from '../user.model'; export class SetUserRoleDto { @IsNotEmpty() username: string; @IsNotEmpty() @IsIn([UserRole.ADMIN, UserRole.EDITOR, UserRole.NORMAL]) role: UserRole; }
Hatulak/rest-epidemics-news-service
src/news/dto/get-news-filter.dto.ts
<filename>src/news/dto/get-news-filter.dto.ts import { NewsStatus } from '../news.model'; import { IsOptional, IsIn } from 'class-validator'; export class GetNewsFilterDto { @IsOptional() @IsIn([NewsStatus.CREATED, NewsStatus.PUBLISHED]) status: NewsStatus; @IsOptional() search: string; @IsOptional() aut...
Hatulak/rest-epidemics-news-service
src/comments/comment.model.ts
import * as mongoose from 'mongoose'; export const CommentSchema = new mongoose.Schema({ details: { type: String, required: true }, nconst: { type: String, required: true }, author: { type: String, required: true }, date: { type: Date, required: true }, }); export interface Comment extends mongoose.Document {...
Hatulak/rest-epidemics-news-service
src/categories/category.model.ts
<gh_stars>0 import * as mongoose from 'mongoose'; export const CategorySchema = new mongoose.Schema({ name: { type: String, required: true }, cconst: { type: String, required: true }, }); export interface Category extends mongoose.Document { id: string; cconst: string; name: string; }
Hatulak/rest-epidemics-news-service
src/comments/comments.service.ts
<gh_stars>0 import { Injectable, NotFoundException, BadRequestException, } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; import { Model } from 'mongoose'; import { Comment } from './comment.model'; import { CreateCommentDto } from './dto/create-comment.dto'; import { UpdateCommentDto } fr...
Hatulak/rest-epidemics-news-service
src/news/news.controller.ts
import { Controller, Get, Post, Body, Param, Delete, Patch, UsePipes, ValidationPipe, Put, UseGuards, UseInterceptors, UploadedFile, BadRequestException, Res, Query, } from '@nestjs/common'; import { NewsService } from './news.service'; import { News, NewsStatus } from './news.model'; im...
Hatulak/rest-epidemics-news-service
src/news/news.module.ts
import { Module } from '@nestjs/common'; import { NewsController } from './news.controller'; import { NewsService } from './news.service'; import { MongooseModule } from '@nestjs/mongoose'; import { NewsSchema } from './news.model'; import { CategorySchema } from 'src/categories/category.model'; import { MulterModule }...
JeremyBYU/AsyncAstar
src/types/heap.d.ts
export interface HeapT<T> { push(a: T); pop(): T; updateItem(a: T): void; }
JeremyBYU/AsyncAstar
src/lib/util.ts
<filename>src/lib/util.ts /** * This module holds utility functions that may be helpful to use with AsyncAstar. * Please note that you do not need to use these utility functions to work with AsyncAstar. * * Notable functions: * * `createPlanner` - Creates an AsyncAstar planner from a passed `ndarray` map. Uses ...
JeremyBYU/AsyncAstar
src/index.ts
// export * from './lib/asyncastar'; import AsyncAstar from './lib/asyncastar' import * as Util from './lib/util' export default {AsyncAstar, Util }
JeremyBYU/AsyncAstar
src/tests/asysnastar.spec.ts
// tslint:disable:no-expression-statement // import anyTest, { TestInterface } from 'ava'; import * as fs from 'fs'; import { join } from 'path'; import ndarray from 'ndarray'; import * as PNGJS from 'pngjs'; import savePixels from 'save-pixels'; import AsyncAstar, { AsyncAstarResult, AsyncAstarStatus } from '../...
JeremyBYU/AsyncAstar
src/lib/asyncastar.ts
/** * AsyncAstar.ts * github.com/jeremybyu/AsyncAstar * Licensed under the MIT license. * * Implementation By <NAME> (@jeremybyu) * * Use AsyncAstar class to instantiate a planner. */ /** ignore this comment */ import FastHeap from 'fastpriorityqueue' import * as Heap from 'heap'; import { HeapT ...
JeremyBYU/AsyncAstar
src/tests/savepixels.ts
import ndarray from 'ndarray'; import ops from 'ndarray-ops'; import PNG1 from 'pngjs-nozlib'; import through from 'through'; const PNG = PNG1.PNG; function handleData(array, data, frame?) { // let i; // let j; // let ptr = 0; if (array.shape.length === 4) { return handleData(array.pick(frame), data, 0); ...
JeremyBYU/AsyncAstar
src/tests/helper.ts
import fs from 'fs'; import Color from 'color'; import ndarray from 'ndarray'; import * as PNGJS from 'pngjs'; // import savePixels from 'save-pixels'; import { createPNG, savePixels } from './savepixels'; import AsyncAstar from '../lib/asyncastar'; import { copyNdarray, NodeData } from '../lib/util'; const ORANGE ...
JeremyBYU/AsyncAstar
src/tests/benchmarks.ts
<reponame>JeremyBYU/AsyncAstar import * as fs from 'fs'; import { join } from 'path'; import * as Benchmark from 'benchmark'; import ndarray from 'ndarray'; import * as PNGJS from 'pngjs'; import AsyncAstar, { AsyncAstarResult, AsyncAstarStatus } from '../lib/asyncastar'; import { copyNdarray, createPlanner, Node...
JeremyBYU/AsyncAstar
src/tests/tester.ts
import * as fs from 'fs'; import { join } from 'path'; import * as Benchmark from 'benchmark'; import ndarray from 'ndarray'; import * as PNGJS from 'pngjs'; import AsyncAstar, { AsyncAstarResult, AsyncAstarStatus } from '../lib/asyncastar'; import { copyNdarray, createPlanner, NodeData } from '../lib/util'; impo...
NDHussin/read-appsettings-json
lib/index.ts
<gh_stars>0 // export class AppConfiguration { // private static instance: AppConfiguration; // private _json: any; // private constructor() { } // static Setting() { // if (!AppConfiguration.instance) { // AppConfiguration.instance = new AppConfiguration(); // App...
NDHussin/read-appsettings-json
dist/index.d.ts
export declare class AppConfiguration { static json: any; constructor(); static Setting(): any; }
minho-comcom-ai/imgproxy-node
src/index.ts
<filename>src/index.ts import type { ImgproxyConfig, ImgproxySecureConfig } from './types.js'; import { ImgproxyBuilder } from './builder.js'; import { isSecureConfig } from './utils.js'; export default class Imgproxy { private readonly config: ImgproxyConfig | ImgproxySecureConfig; constructor(config: ImgproxyCo...
minho-comcom-ai/imgproxy-node
src/builder.ts
import { URL } from 'url'; import type { FocusPoint, Gravity, HexColor, ImgproxyConfig, ResizingType, RGBColor, WatermarkOffset, WatermarkPosition, } from './types.js'; import { isFocusPoint, isRGBColor, isSecureConfig, sign } from './utils.js'; export class ImgproxyBuilder { private readonly config:...
minho-comcom-ai/imgproxy-node
__test__/index.test.ts
import { expect, test, describe, beforeAll } from '@jest/globals'; import Imgproxy, { Gravity } from '../src/index.js'; describe('readme', () => { beforeAll(() => { process.env.IMGPROXY_KEY = 'ffffff'; process.env.IMGPROXY_SALT = 'ffffff'; }); test('the only test', () => { const imgproxy = new Imgpr...
minho-comcom-ai/imgproxy-node
src/utils.ts
import { createHmac } from 'crypto'; import { FocusPoint, ImgproxyConfig, ImgproxySecureConfig, RGBColor, } from './types.js'; export const isRGBColor = (obj: RGBColor | unknown): obj is RGBColor => { return ( typeof obj === 'object' && obj !== null && 'r' in obj && 'g' in obj && 'b' in o...
MasatoMakino/pixijs-basic-button
lib/BasicButtonState.d.ts
<reponame>MasatoMakino/pixijs-basic-button<filename>lib/BasicButtonState.d.ts /** * ボタン状態を表す定数 */ export declare enum BasicButtonState { NORMAL = "normal", NORMAL_OVER = "normal_over", NORMAL_DOWN = "normal_down", DISABLE = "disable", SELECT = "select", SELECT_OVER = "select_over", SELECT_...
MasatoMakino/pixijs-basic-button
lib/BasicRadioButton.d.ts
import { InteractionEvent } from "pixi.js"; import { BasicCheckButton } from "./BasicCheckButton"; /** * 排他的に選択可能なボタン。ラジオボタンのセットはBasicRadioButtonManagerで設定する。 */ export declare class BasicRadioButton extends BasicCheckButton { /** * ボタンを選択する。 * @param evt */ selectButton(evt?: InteractionEvent)...
MasatoMakino/pixijs-basic-button
lib/BasicButtonContext.d.ts
import { BasicClickButton } from "./BasicClickButton"; export declare class BasicButtonContext { index: number; buttonValue: any; target: BasicClickButton; constructor(target: BasicClickButton, value: any); } export declare enum BasicButtonEventType { SELECTED = "button_event_select", UNSELECTED...
MasatoMakino/pixijs-basic-button
src/ButtonMaterialSet.ts
<reponame>MasatoMakino/pixijs-basic-button<filename>src/ButtonMaterialSet.ts import { BasicButtonState } from "./BasicButtonState"; import { BasicClickButton } from "./BasicClickButton"; import { DisplayObject, Text } from "pixi.js"; class ButtonOptionSet<T> { normal!: T; over?: T; down?: T; disable?: T; sel...
MasatoMakino/pixijs-basic-button
lib/BasicCheckButton.d.ts
import { InteractionEvent } from "pixi.js"; import { BasicButtonState } from "./BasicButtonState"; import { BasicClickButton } from "./BasicClickButton"; /** * 選択状態を持つボタンクラス。 */ export declare class BasicCheckButton extends BasicClickButton { protected _isSelect: boolean; pressButton(evt?: InteractionEvent): ...
MasatoMakino/pixijs-basic-button
src/BasicClickButton.ts
<filename>src/BasicClickButton.ts<gh_stars>0 import * as PIXI from "pixi.js"; import { Container, InteractionEvent, Text } from "pixi.js"; import { BasicButtonState } from "./BasicButtonState"; import { ButtonLabelColorSet, ButtonMaterialSet } from "./ButtonMaterialSet"; /** * 基本ボタンクラス。 * 選択状態を持たず、クリックした時点で結果が反映されるタ...
MasatoMakino/pixijs-basic-button
__test__/BasicCheckButton.spec.ts
<filename>__test__/BasicCheckButton.spec.ts import { BasicButtonState, BasicCheckButton } from "../src"; import { getTestMaterialSet, testMaterialVisible } from "./TestMaterial"; describe("BasicCheckButton", () => { const mat = getTestMaterialSet(); const button = new BasicCheckButton(mat); test("constructor", ...
MasatoMakino/pixijs-basic-button
src/BasicCheckButton.ts
import { InteractionEvent } from "pixi.js"; import { BasicButtonContext, BasicButtonEventType } from "./BasicButtonContext"; import { BasicButtonState } from "./BasicButtonState"; import { BasicClickButton } from "./BasicClickButton"; /** * 選択状態を持つボタンクラス。 */ export class BasicCheckButton extends BasicClickButton { ...
MasatoMakino/pixijs-basic-button
src/BasicRadioButton.ts
<filename>src/BasicRadioButton.ts import { InteractionEvent } from "pixi.js"; import { BasicButtonContext, BasicButtonEventType } from "./BasicButtonContext"; import { BasicButtonState } from "./BasicButtonState"; import { BasicCheckButton } from "./BasicCheckButton"; /** * 排他的に選択可能なボタン。ラジオボタンのセットはBasicRadioButtonMan...
MasatoMakino/pixijs-basic-button
__test__/BasicRadioButtonManager.spec.ts
import { BasicButtonState, BasicRadioButton, BasicRadioButtonManager, } from "../src"; import { getTestMaterialSet } from "./TestMaterial"; describe("BasicRadioButtonManager", () => { const spyWarn = jest.spyOn(console, "warn"); spyWarn.mockImplementation((x) => x); const values = [0, "", null, { x: 0 }, ...
MasatoMakino/pixijs-basic-button
lib/BasicClickButton.d.ts
<reponame>MasatoMakino/pixijs-basic-button import * as PIXI from "pixi.js"; import { Container, InteractionEvent, Text } from "pixi.js"; import { BasicButtonState } from "./BasicButtonState"; import { ButtonLabelColorSet, ButtonMaterialSet } from "./ButtonMaterialSet"; /** * 基本ボタンクラス。 * 選択状態を持たず、クリックした時点で結果が反映されるタイプの...
MasatoMakino/pixijs-basic-button
__test__/BasicClickButton.spec.ts
import { BasicButtonState, BasicClickButton } from "../src"; import { getTestMaterialSet, testMaterialVisible } from "./TestMaterial"; describe("BasicClickButton", () => { const mat = getTestMaterialSet(); const dummyMat = getTestMaterialSet(); const button = new BasicClickButton(dummyMat); button.initMaterial...
MasatoMakino/pixijs-basic-button
__test__/BasicButtonLabel.spec.ts
<filename>__test__/BasicButtonLabel.spec.ts import { TextStyle } from "pixi.js"; import { BasicClickButton } from "../src"; import { getTestLabelColorSet, getTestMaterialSet } from "./TestMaterial"; describe("BasicClickButton", () => { const mat = getTestMaterialSet(); const labelColor = getTestLabelColorSet(); ...
MasatoMakino/pixijs-basic-button
lib/ButtonMaterialSet.d.ts
<reponame>MasatoMakino/pixijs-basic-button import { BasicButtonState } from "./BasicButtonState"; import { BasicClickButton } from "./BasicClickButton"; import { DisplayObject, Text } from "pixi.js"; declare class ButtonOptionSet<T> { normal: T; over?: T; down?: T; disable?: T; selectNormal?: T; ...
MasatoMakino/pixijs-basic-button
__test__/BasicRadioButton.spec.ts
import { BasicButtonState, BasicRadioButton } from "../src"; import { getTestMaterialSet, testMaterialVisible } from "./TestMaterial"; describe("BasicRadioButton", () => { const mat = getTestMaterialSet(); const button = new BasicRadioButton(mat); test("constructor", () => { expect(button).toBeTruthy(); ...
MasatoMakino/pixijs-basic-button
src/index.ts
export * from "./BasicClickButton"; export * from "./BasicButtonContext"; export * from "./BasicButtonState"; export * from "./ButtonMaterialSet"; export * from "./BasicCheckButton"; export * from "./BasicRadioButton"; export * from "./BasicRadioButtonManager";
MasatoMakino/pixijs-basic-button
lib/BasicRadioButtonManager.d.ts
import { BasicRadioButton } from "./BasicRadioButton"; import * as PIXI from "pixi.js"; /** * 排他的に選択されるボタンを制御するクラスです。 * * メンバーのBasicRadioButtonが変更されると、このクラスに変更内容が通知されます。 * このクラスは変更通知に応じ、他のBasicRadioButtonオブジェクトの選択状態を変更します。 * また、このクラスは変更内容をEventとして発信します。 * * 利用する際には以下のような手順でインスタンス化してください。 * * let btn:BasicRadio...
MasatoMakino/pixijs-basic-button
__test__/ButtonMaterialSet.spec.ts
import { BasicButtonState, ButtonMaterialSet } from "../src"; import { getTestMaterialSet, getTestMaterialSetNormalOnly, testMaterialVisible, } from "./TestMaterial"; describe("ButtonMaterialSet", () => { const mat = getTestMaterialSet(); test("constructor", () => { expect(mat).toBeTruthy(); }); te...
MasatoMakino/pixijs-basic-button
src/BasicButtonContext.ts
<filename>src/BasicButtonContext.ts import { BasicClickButton } from "./BasicClickButton"; export class BasicButtonContext { public index!: number; public buttonValue: any = null; public target: BasicClickButton; constructor(target: BasicClickButton, value: any) { this.target = target; this.buttonValu...
MasatoMakino/pixijs-basic-button
__test__/TestMaterial.ts
<filename>__test__/TestMaterial.ts import { DisplayObject, Graphics } from "pixi.js"; import { BasicButtonState, ButtonLabelColorSet, ButtonMaterialSet, } from "../src"; /** * テスト用の共通マテリアルを生成する */ export enum TestMaterialColor { normal, down, over, disable, selectNormal, selectDown, selectOver, ...
MasatoMakino/pixijs-basic-button
src/BasicRadioButtonManager.ts
import { BasicRadioButton } from "./BasicRadioButton"; import { BasicButtonContext, BasicButtonEventType } from "./BasicButtonContext"; import * as PIXI from "pixi.js"; /** * 排他的に選択されるボタンを制御するクラスです。 * * メンバーのBasicRadioButtonが変更されると、このクラスに変更内容が通知されます。 * このクラスは変更通知に応じ、他のBasicRadioButtonオブジェクトの選択状態を変更します。 * また、このクラス...
qoq-ts/demo-hello-world
src/migrations/20210226171332-create-project.ts
import { column, literal, migration } from 'qoq-sequelize'; export default migration({ async up(queryInterface) { await queryInterface.createTable('project', { id: column.int.primaryKey().autoIncrement(), user_id: column.int.notNull(), title: column.varChar.notNull(), description: column....
qoq-ts/demo-hello-world
src/commands/hello.ts
<reponame>qoq-ts/demo-hello-world<gh_stars>1-10 import chalk from 'chalk'; import { ConsoleRouter, validator } from 'qoq'; import { consoleSlots } from '../bootstrap/consoleSlot'; export const router = new ConsoleRouter({ slots: consoleSlots, }); router .command('say:hello') .showInHelp() .docs({ descript...
qoq-ts/demo-hello-world
src/routers/user.ts
<reponame>qoq-ts/demo-hello-world import { validator, WebRouter } from 'qoq'; import { advancedSlots } from '../bootstrap/webSlot'; import { User } from '../models/User'; export const router = new WebRouter({ prefix: '/users', slots: advancedSlots, }); router .get('/') .query({ page: validator.number, ...
qoq-ts/demo-hello-world
src/models/User.ts
import { column, defineModel, Op } from 'qoq-sequelize'; import { Project } from './Project'; export const User = defineModel({ attributes: { id: column.int.primaryKey().autoIncrement(), name: column.varChar.notNull(), age: column.int.notNull(), }, associations: { projects: () => User.hasMany(Pro...
qoq-ts/demo-hello-world
src/configs/config.production.ts
import { defineConfig, FileCache, FileCacheOptions } from 'qoq'; import { SequelizeOptions } from 'qoq-sequelize'; const productionConfig = { cache: defineConfig<FileCacheOptions>({ engine: FileCache, cacheDir: './caches', }), db: defineConfig<SequelizeOptions>({ dialect: 'mysql', logging: false,...
qoq-ts/demo-hello-world
src/configs/config.development.ts
import { defineConfig, MemoryCache, MemoryCacheOptions } from 'qoq'; import { SequelizeOptions } from 'qoq-sequelize'; import { Config } from '.'; const developmentConfig: Config = { cache: defineConfig<MemoryCacheOptions>({ engine: MemoryCache, }), db: defineConfig<SequelizeOptions>({ dialect: 'sqlite',...
qoq-ts/demo-hello-world
src/routers/index.ts
import { validator, WebRouter } from 'qoq'; import { webSlots } from '../bootstrap/webSlot'; export const router = new WebRouter({ slots: webSlots, // slots: advancedSlots, }); router .get('/') .query({ name: validator.string.default('World'), }) .action(async (ctx) => { ctx.body = 'Hello ' + ctx....
qoq-ts/demo-hello-world
src/bootstrap/sequelize.ts
<reponame>qoq-ts/demo-hello-world import { Sequelize, SequelizeSlot } from 'qoq-sequelize'; import { config } from '../configs'; export const db = new Sequelize({ // Optional migrationsDir: './src/migrations', // Optional modelsDir: './src/models', // Optional seedersDir: './src/seeders', ...config.db, }...
qoq-ts/demo-hello-world
src/models/Project.ts
<filename>src/models/Project.ts import { column, defineModel } from 'qoq-sequelize'; import { User } from './User'; export const Project = defineModel({ attributes: { id: column.int.primaryKey(), userId: column.int.notNull(), title: column.varChar.notNull(), description: column.text, }, associati...
qoq-ts/demo-hello-world
src/configs/index.ts
<filename>src/configs/index.ts import type productionConfig from './config.production'; const env = process.env.NODE_ENV || 'development'; export const config: typeof productionConfig = require('./config.' + env).default; export type Config = Record<keyof typeof productionConfig, any>;
qoq-ts/demo-hello-world
src/console.ts
<filename>src/console.ts import { ConsoleApplication } from 'qoq'; import { db } from './bootstrap/sequelize'; const app = new ConsoleApplication({ // Optional commandsDir: [__dirname + '/commands'], }); db.mountCommands(app); app.execute().then(() => { // Optional process.exit(0); });
qoq-ts/demo-hello-world
src/web.ts
<reponame>qoq-ts/demo-hello-world import { WebApplication } from "qoq"; const app = new WebApplication({ // Optional routersDir: __dirname + '/routers', }); app.listen(3000, () => { console.log('Server started'); });
qoq-ts/demo-hello-world
src/bootstrap/consoleSlot.ts
import { ConsoleSlotManager, Tree } from 'qoq'; import { dbSlot } from './sequelize'; export const consoleSlots = ConsoleSlotManager.use(dbSlot); Tree.trunk(consoleSlots);
qoq-ts/demo-hello-world
src/bootstrap/webSlot.ts
import { CacheSlot, Tree, WebSlotManager } from "qoq"; import { Cors } from 'qoq-cors'; import { Etag } from 'qoq-etag'; import { Morgan } from "qoq-morgan"; import { config } from '../configs'; import { dbSlot } from './sequelize'; export const webSlots = WebSlotManager .use(new Etag()) .use(new Morgan('combined'...
mauroccvieira/learning-with-rpg
src/domain/character/entities/attributes.entity.ts
<gh_stars>0 export interface Attributes { str: number; dex: number; con: number; cha: number; wis: number; int: number; }
mauroccvieira/learning-with-rpg
src/index.ts
<filename>src/index.ts #!/usr/bin/env node import { main } from "./infra/main"; main();
mauroccvieira/learning-with-rpg
src/domain/attributes/builders/attribute-array-builder/attribute-array-director.ts
<filename>src/domain/attributes/builders/attribute-array-builder/attribute-array-director.ts import { Attributes } from "../../entities/attributes.entity"; import { AttributeArrayBuilderInterface } from "./interface/attribute-array-builder.interface"; export class AttributeArrayDirector { constructor(private arrayBu...
mauroccvieira/learning-with-rpg
src/domain/character/usecase/create-non-player-character.ts
<reponame>mauroccvieira/learning-with-rpg import Character from "../entities/character.entity"; import { CreateStarterAttributes } from "../gateway/create-starter-attributes.interface"; export function createNPC( name: string, getAttributes: CreateStarterAttributes ) { return new Character(name, getAttributes())...
mauroccvieira/learning-with-rpg
src/domain/attributes/builders/attribute-array-builder/builders/hero-attribute-array-builder.ts
<filename>src/domain/attributes/builders/attribute-array-builder/builders/hero-attribute-array-builder.ts import { AttributeArrayBuilderInterface } from "../interface/attribute-array-builder.interface"; export class HeroAttributeArrayBuilder implements AttributeArrayBuilderInterface { build(): [number, number, num...
mauroccvieira/learning-with-rpg
src/infra/main.ts
<reponame>mauroccvieira/learning-with-rpg import { CreateAttributeArray } from "../domain/attributes/usecase/create-attribute-array"; import { createNPC } from "../domain/character/usecase/create-non-player-character"; export const main = async () => { const grog = createNPC("Grog, the Barbarian", () => CreateAt...
mauroccvieira/learning-with-rpg
src/infra/main.test.ts
<reponame>mauroccvieira/learning-with-rpg import { greet } from "./main"; test("the data is peanut butter", () => { expect(1).toBe(1); }); test("greeting", () => { expect(greet("Foo")).toBe("Hello Foo"); });
mauroccvieira/learning-with-rpg
src/domain/character/gateway/create-starter-attributes.interface.ts
<gh_stars>0 import { Attributes } from "../entities/attributes.entity"; export type CreateStarterAttributes = () => Attributes;
mauroccvieira/learning-with-rpg
src/domain/attributes/usecase/create-attribute-array.ts
<gh_stars>0 import { AttributeArrayDirector } from "../builders/attribute-array-builder/attribute-array-director"; import { EpicAttributeArrayBuilder } from "../builders/attribute-array-builder/builders/epic-attribute-array-builder"; import { HeroAttributeArrayBuilder } from "../builders/attribute-array-builder/builder...
mauroccvieira/learning-with-rpg
src/domain/character/entities/character.entity.ts
<reponame>mauroccvieira/learning-with-rpg<filename>src/domain/character/entities/character.entity.ts import { Attributes } from "./attributes.entity"; export class Character { _name: string; _attr: Attributes; get name() { return this._name; } get attr() { return this._attr; } constructor(name: ...
mauroccvieira/learning-with-rpg
src/domain/attributes/builders/attribute-array-builder/interface/attribute-array-builder.interface.ts
<gh_stars>0 export interface AttributeArrayBuilderInterface { build(): [number, number, number, number, number, number]; }
piotrryczek/documents-backend
src/validation-schemas/update-record.ts
import * as yup from 'yup'; import { Kind, Category } from 'src/types'; export const updateRecordPayloadSchema = yup.object().shape({ catalog: yup.string().required(), kind: yup.string().oneOf(Object.values(Kind)).required(), category: yup.string().oneOf(Object.values(Category)).required(), expirationDate: yu...
piotrryczek/documents-backend
src/validation-schemas/search-records.ts
import * as yup from 'yup'; import { Kind, Category } from 'src/types'; export const searchRecordsQuerySchema = yup.object().shape({ boxes: yup.array().of(yup.string()), catalogs: yup.array().of(yup.string()), kinds: yup.array().of(yup.string().oneOf(Object.values(Kind))), categories: yup.array().of(yup.strin...
piotrryczek/documents-backend
src/app.service.ts
<reponame>piotrryczek/documents-backend import { Model } from 'mongoose'; import { InjectModel } from '@nestjs/mongoose'; import { Injectable } from '@nestjs/common'; import { Record, RecordDocument } from './schemas/record.schema'; @Injectable() export class AppService { constructor( @InjectModel(Record.name) ...
piotrryczek/documents-backend
src/app.module.ts
import { Module } from '@nestjs/common'; import { MongooseModule } from '@nestjs/mongoose'; import { Record, RecordSchema } from 'src/schemas/record.schema'; import { AppController } from './app.controller'; import { AppService } from './app.service'; @Module({ imports: [ MongooseModule.forRoot('mongodb://loca...
piotrryczek/documents-backend
src/app.controller.ts
import { Controller, Get, Param, Post, Body, Patch, Delete, Query, } from '@nestjs/common'; import { AppService } from './app.service'; import { createRecordPayloadSchema, updateRecordPayloadSchema, searchRecordsQuerySchema, } from 'src/validation-schemas'; @Controller() export class AppControlle...
piotrryczek/documents-backend
src/types/kind.ts
<filename>src/types/kind.ts export enum Kind { RECEIPT = 'RECEIPT', INVOICE = 'INVOICE', DOCUMENT = 'DOCUMENT', }
piotrryczek/documents-backend
src/validation-schemas/index.ts
<filename>src/validation-schemas/index.ts export * from './create-record'; export * from './update-record'; export * from './search-records';
piotrryczek/documents-backend
src/schemas/record.schema.ts
<gh_stars>0 import { Document } from 'mongoose'; import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Kind, Category } from 'src/types'; export type RecordDocument = Record & Document; @Schema() export class Record { @Prop() box: string; @Prop() catalog: string; @Prop({ type: Stri...
piotrryczek/documents-backend
src/types/category.ts
export enum Category { TAX_OFFICE = 'TAX_OFFICE', CAR = 'CAR', FUEL = 'FUEL', OTHER_OFFICE = 'OTHER_OFFICE', WARRANTY = 'WARRANTY', HEALTH = 'HEALTH', COURT = 'COURT', ELECTRONICS = 'ELECTRONICS', CLOTHES = 'CLOTHES', }
enlear/bit-react-material-themes
enlear.react-material-themes/widgets/profile/profile.tsx
import Avatar from '@material-ui/core/Avatar'; import Button from '@material-ui/core/Button'; import Card from '@material-ui/core/Card'; import CardActions from '@material-ui/core/CardActions'; import CardContent from '@material-ui/core/CardContent'; import CardHeader from '@material-ui/core/CardHeader'; import { red }...
enlear/bit-react-material-themes
enlear.react-material-themes/themes/business-theme/business-theme.tsx
<gh_stars>0 import blue from '@material-ui/core/colors/blue'; import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles'; import React from 'react'; export interface BusinessThemeProps extends React.HTMLAttributes<React.ReactNode> { }; export function BusinessTheme({ children }: BusinessThemeProps) { ...
enlear/bit-react-material-themes
enlear.react-material-themes/pages/dashboard/dashboard.composition.tsx
<reponame>enlear/bit-react-material-themes import { BusinessTheme } from '@enlear/react-material-themes.themes.business-theme'; import { CasualTheme } from '@enlear/react-material-themes.themes.casual-theme'; import React from 'react'; import { Dashboard } from './dashboard'; const profiles = [{ name: "<NAME>", ti...
enlear/bit-react-material-themes
enlear.react-material-themes/widgets/header/header.spec.tsx
<gh_stars>0 import { render } from '@testing-library/react'; import React from 'react'; import { BusinessHeader, CasualHeader } from './header.composition'; describe('header', () => { it('business header should render with the correct text', () => { const { getByText } = render(<BusinessHeader />); const ren...
enlear/bit-react-material-themes
enlear.react-material-themes/pages/dashboard/dashboard.spec.tsx
<reponame>enlear/bit-react-material-themes<gh_stars>0 import { render } from '@testing-library/react'; import React from 'react'; import { BusinessDashboard, CasualDashboard } from './dashboard.composition'; describe('dashboard', () => { it('business dashboard should contain 4 profiles in the grid', () => { cons...
enlear/bit-react-material-themes
enlear.react-material-themes/widgets/header/header.composition.tsx
import { BusinessTheme } from '@enlear/react-material-themes.themes.business-theme'; import { CasualTheme } from '@enlear/react-material-themes.themes.casual-theme'; import React from 'react'; import { Header } from './header'; export const BusinessHeader = () => ( <BusinessTheme> <Header title="Employees"/> <...
enlear/bit-react-material-themes
enlear.react-material-themes/themes/casual-theme/index.ts
export { CasualTheme } from './casual-theme'; export type { CasualThemeProps } from './casual-theme';
enlear/bit-react-material-themes
enlear.react-material-themes/themes/business-theme/business-theme.composition.tsx
<reponame>enlear/bit-react-material-themes import { Header } from '@enlear/react-material-themes.widgets.header'; import { Profile } from '@enlear/react-material-themes.widgets.profile'; import { Grid } from '@material-ui/core'; import React from 'react'; import { BusinessTheme } from './business-theme'; export const ...
enlear/bit-react-material-themes
enlear.react-material-themes/widgets/profile/profile.composition.tsx
import { BusinessTheme } from '@enlear/react-material-themes.themes.business-theme'; import { CasualTheme } from '@enlear/react-material-themes.themes.casual-theme'; import React from 'react'; import { Profile } from './profile'; export const BusinessProfile = () => ( <BusinessTheme> <Profile name="<NAME>" title...
enlear/bit-react-material-themes
enlear.react-material-themes/pages/dashboard/index.ts
export { Dashboard } from './dashboard'; export type { DashboardProps } from './dashboard';
enlear/bit-react-material-themes
enlear.react-material-themes/themes/casual-theme/casual-theme.tsx
<reponame>enlear/bit-react-material-themes import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles'; import React from 'react'; export interface CasualThemeProps extends React.HTMLAttributes<React.ReactNode> { }; export function CasualTheme({ children }: CasualThemeProps) { const casualTheme = creat...
enlear/bit-react-material-themes
enlear.react-material-themes/themes/casual-theme/casual-theme.spec.tsx
import { render } from '@testing-library/react'; import React from 'react'; import { BasicCasualTheme } from './casual-theme.composition'; describe('casual-theme', () => { it('should render with the correct text', () => { const { getByText } = render(<BasicCasualTheme />); const rendered = getByText('Employe...