Open in app

Sign In

Write

Sign In

Yadollah khaje hosseini
Yadollah khaje hosseini

11 Followers

Home

About

Aug 28

Install Swagger in Nestjs

npm install @nestjs/swagger swagger-ui-express in main.ts import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; const options = new DocumentBuilder() .setTitle('API ***') .setDescription('API ***') .setVersion('7.1.8') .addBearerAuth() .addTag('api') .build(); const document = SwaggerModule.createDocument(app, options); SwaggerModule.setup('docs', app, document, { swaggerOptions: { persistAuthorization: true, }, });

Nestjs

1 min read

Nestjs

1 min read


Aug 14

Get diff Year in MongoDb

db.embryosTransfer.find().forEach(function (doc1) { var doc2 = db.users.findOne({ _id: doc1.patientUserId }); if (doc2 != null) { let date1 = new Date(doc2.dateOfBirth); let date2 = new Date(doc1.date); let diffTime = Math.abs(date2 - date1); let diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); let diffYears = Math.floor(diffTime / (1000 * 60 * 60 * 24 * 365)); let daysLastYear = diffDays - ( diffYears * 365); if( daysLastYear>= 180){ diffYears +=1; } db.embryosTransfer.update({'_id' : doc1._id}, [ { $set: { "age" :diffYears} } ]); } });

Mongodb

1 min read

Mongodb

1 min read


Jul 29

Sesstion1 of Beginner DevOps

Http Concepts What kind of attacks does SSL prevent? https://venafi.com/machine-identity-basics/the-most-common-ssl-and-tls-attacks/ Man-in-the-Middle (MITM) Duty HTML: Easy Transfer Html files Request Header Request Body Response Header Response Body Request Header: VERB = Method = Request Type GET à Request the specified resource Provide me with a resource from the server POST à…

DevOps

3 min read

Sesstion1 of Beginner DevOps
Sesstion1 of Beginner DevOps
DevOps

3 min read


Dec 19, 2022

Update And find All Nested Quey In MongoDB

db.medicalRecords.updateMany({$and:[{legalVisits: { $exists: true, $ne: [] }},{“legalVisits.legalVisitType”:”donated_egg”}]},{$set:{ “legalVisits.$[].legalVisitType” : “Ali”}}) db.medicalRecords.findOne({$and:[{forensicMedicineVisits: { $exists: true, $ne: [] }},{“forensicMedicineVisits.forensicMedicineVisitType”:”donated_egg”}]})

Mongodb

1 min read

Mongodb

1 min read


Nov 7, 2022

Downloading data in excel format with PHP And Unicode

public function _exportToCSV($status){ $columnHeader = ""; $setData = ''; $findAll = ImportUsers::model()->findAll("status = $status"); if(!empty($findAll)){ foreach($findAll as $objData){ $rowData = ''; $value = '"' . $objData->title1 . '"' . "\t"; $value .= '"' . $objData->title2 . '"' . "\t"; $value .= '"' . $objData->title3 . '"' . "\t"; $rowData .= $value; $setData .= trim($rowData) . "\n"; } } $fileName = 'output.csv'; header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename = $fileName"); header('Content-Transfer-Encoding: binary'); header("Pragma: no-cache"); header("Expires: 0"); echo chr(255).chr(254).iconv("UTF-8", "UTF-16LE//IGNORE", $setData . "\n"); exit(); }

Csv

1 min read

Csv

1 min read


Sep 13, 2022

Order By Persian Title In MySQL

1: Change Collection Field To “utf8_persian_ci” 2: In Query SELECT * FROM campaigns ORDER BY title COLLATE utf8_persian_ci 3: In Yii Framework $academics = Academic::find() ->where([ ‘organization_id’ => $_POST[‘organization’], ‘academic_year_id’ => $_POST[‘academicYear’], ‘base_id’ => $_POST[‘base’], ‘field_id’ => $_POST[‘field’] ]) ->andWhere([‘IN’,’status’,$arrayStatus]) ->joinWith(‘profiles p’)

MySQL

1 min read

Order By Persian Title In MySQL
Order By Persian Title In MySQL
MySQL

1 min read


Aug 21, 2022

FindOne For Nested Document In NestJs

async findOne(findOneTurnOfTimePlanDetailDto: FindOneTurnOfTimePlanDetailDto ){ let filter = { _id: findOneTurnOfTimePlanDetailDto.planDetailId…

Nestjs

1 min read

Nestjs

1 min read


Aug 13, 2022

Search like number field in MongoDb by NestJs

let aggregateTotal = []; let aggregateMatch = {}; if (searchServiceDto.hasOwnProperty('code')) { Object.assign(aggregateMatch, { codeStr: new RegExp(searchServiceDto.code.toString()), }); } aggregateTotal.push( { $addFields : { codeStr: { $toString: '$code' } } } ) aggregateTotal.push({ $match: aggregateMatch, }); aggregateTotal.push( { $project : { codeStr: 0 } } )

Mongodb

1 min read

Mongodb

1 min read


Jul 11, 2022

Downloading data in excel format with Nest.js

1: use :: https://wajihaabid.medium.com/downloading-data-in-excel-format-with-nest-js-4a0a859bf430 excel.controller.ts import {Controller, Get, Header, Res} from '@nestjs/common'; import { ExcelService } from './excel.service'; import {Response} from "express"; @Controller('excel') export class ExcelController { constructor(private readonly excelService: ExcelService) {} @Get('/download') @Header('Content-Type', 'text/xlsx') async downloadReport(@Res() res: Response) { let data = […

Nestjs

1 min read

Nestjs

1 min read


Jun 14, 2022

Deploy simple nestJs application on Server

1: install Node https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-20-04 curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh nano nodesource_setup.sh bash nodesource_setup.sh apt install nodejs node -v npm -v apt install build-essential npm audit 2:install mongo https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-20-04

Nestjs

1 min read

Nestjs

1 min read

Yadollah khaje hosseini

Yadollah khaje hosseini

11 Followers

I am a Back-End Developer

Following
  • Eason Chai

    Eason Chai

  • Hafez Heybati Goujani

    Hafez Heybati Goujani

  • Royi Benita, Senior Full Stack Developer At Armis

    Royi Benita, Senior Full Stack Developer At Armis

  • Vladimir Agaev

    Vladimir Agaev

  • Kevin Vogel

    Kevin Vogel

See all (11)

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech

Teams