Skip to content

Instantly share code, notes, and snippets.

View saurabhpati's full-sized avatar

Saurabh Pati saurabhpati

View GitHub Profile
@saurabhpati
saurabhpati / EntityBase.cs
Created April 21, 2019 09:02
Stored procedure - EF Core
/// <summary>
/// Using this class for base will default the primary key of the entity to be int.
/// </summary>
public class EntityBase : EntityBase<int>
{
}
/// <summary>
/// The base entity.
/// </summary>
import { Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { JwtModule } from '@nestjs/jwt';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
import { JwtStrategy } from './jwt.strategy';
import { UserService } from '../user/user.service';
import { UserModule } from '../user/user.module';
@Module({
@saurabhpati
saurabhpati / auth.controller.ts
Created March 4, 2019 15:18
Auth Controller
import { UserDto } from './dto/user.dto';
import { AuthService } from './auth.service';
import { Controller, Post, Body } from '@nestjs/common';
@Controller('auth')
export class AuthController {
constructor(private readonly authService: AuthService) {
}
import { Injectable } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { JwtPayload } from './interfaces/jwt-payload.interface';
import { UserDto } from './dto/user.dto';
import { UserService } from '../user/user.service';
@Injectable()
export class AuthService {
constructor(
private readonly jwtService: JwtService,
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from './user.entity';
import { UserController } from './user.controller';
import { UserService } from './user.service';
@Module({
imports: [TypeOrmModule.forFeature([User])],
providers: [UserService],
controllers: [UserController]
@saurabhpati
saurabhpati / user.controller.ts
Created March 4, 2019 14:48
User Controller
import { Controller, Post, Get, Body, Query, Put, Delete } from '@nestjs/common';
import { UserService } from './user.service';
import { CreateUserDto } from './dtos/create.user.dto';
import { UpdateUserDto } from './dtos/update.user.dto';
@Controller('User')
export class UserController {
constructor(private readonly userService: UserService) {
}
@saurabhpati
saurabhpati / user.service.ts
Created February 20, 2019 15:15
User Service
import { Injectable, Query } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository, UpdateResult, DeleteResult } from 'typeorm';
import * as bcrypt from 'bcrypt-nodejs';
import { User } from './user.entity';
import { CreateUserDto } from './dtos/create.user.dto';
import { UpdateUserDto } from './dtos/update.user.dto';
@Injectable()
export class UserService {
@saurabhpati
saurabhpati / user.entity.ts
Created February 19, 2019 15:29
User Entity
import { PrimaryGeneratedColumn, Column, Entity, OneToMany, ManyToMany } from 'typeorm';
@Entity()
export class User {
@PrimaryGeneratedColumn()
id: number;
@Column({ length: 128 })
firstName: string;
@saurabhpati
saurabhpati / main.cs
Created November 20, 2018 09:04
c# create table function
private static StringBuilder CreateTableHeader()
{
StringBuilder s = new StringBuilder();
//s.AppendLine("<html>");
//s.AppendLine("<head>");
//s.AppendLine("<meta charset=\"UTF - 8\">");
//s.AppendLine("<meta name=\"viewport\" content=\"width = device - width, initial - scale = 1, maximum - scale = 1\">");
//s.AppendLine("<style>body { padding: 0; margin: 0; }</style>");
//s.AppendLine("</head>");
//s.AppendLine("<body>");
@saurabhpati
saurabhpati / github-card.js
Created July 22, 2018 15:10
Github card addition using react
const Card = props => {
return (
<div style={{marginLeft:'1em'}}>
<img width="75" src={props.avatar_url}/>
<div style={{display: 'inline-block', marginLeft: 10}}>
<div style={{fontSize:'1.25em', fontWeight:'bold'}}>
<div>Name: {props.name}</div>
<div>Company: {props.company}</div>
</div>
</div>