Skip to content

Instantly share code, notes, and snippets.

View illusi03's full-sized avatar
:octocat:
What's happening ?

Bambang Mohammad Azhari illusi03

:octocat:
What's happening ?
View GitHub Profile
@illusi03
illusi03 / create-customer.dto.ts
Last active May 4, 2024 01:10
Article Medium - Enhanced validation in Nest.js - STEP-5
import { Type } from 'class-transformer';
import { IsEmail, IsNotEmpty, ValidateNested } from 'class-validator';
class AddressCustomerType {
@IsNotEmpty()
city: string;
@IsNotEmpty()
address: string;
}
@illusi03
illusi03 / main.ts
Created May 4, 2024 00:03
Article Medium - Enhanced validation in Nest.js - STEP-4
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { ValidationPipe } from '@nestjs/common';
import {
ValidationFilter,
exceptionFactory,
} from './exceptions/validation.filter';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
@illusi03
illusi03 / app.controller.ts
Created May 3, 2024 23:41
Article Medium - Enhanced validation in Nest.js - STEP-3
import { Body, Controller, Post } from '@nestjs/common';
import { AppService } from './app.service';
import { CreateCustomerDto } from './dto/create-customer.dto';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Post('/customer')
registerCustomer(@Body() body: CreateCustomerDto) {
@illusi03
illusi03 / app.controller.ts
Last active May 3, 2024 23:39
Article Medium - Enhanced validation in Nest.js - STEP-1
import { Body, Controller, Post } from '@nestjs/common';
import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Post('/customer')
registerCustomer(@Body() body: any) {
return body;
@illusi03
illusi03 / ctrl-enter.js
Created February 12, 2023 08:54 — forked from KacperKozak/ctrl-enter.js
[Ctrl] + [Enter] to Submit Forms
document.body.addEventListener('keydown', function(e) {
if(!(e.keyCode == 13 && (e.metaKey || e.ctrlKey))) return;
var target = e.target;
if(target.form) {
target.form.submit();
}
});
@illusi03
illusi03 / .gitconfig
Created August 17, 2020 02:39 — forked from sarthaksavvy/.gitconfig
Git configuration
[alias]
acm = "!f() { git add . && git commit -m \"$(echo $@)\"; }; f";
com = checkout master
cob = checkout -b
b = branch
p = push
pl = pull
s = status
@illusi03
illusi03 / .gitconfig
Created August 17, 2020 02:39 — forked from sarthaksavvy/.gitconfig
Git configuration
[alias]
acm = "!f() { git add . && git commit -m \"$(echo $@)\"; }; f";
com = checkout master
cob = checkout -b
b = branch
p = push
pl = pull
s = status