View marker.component.ts
addMarker({ simplifiedMarker, map, options }: AddMarker ): void { | |
if (options.icon === 'default') { | |
options.icon = null; | |
} | |
// oluşturulacak markerin özelliklerini belirler. | |
const marker = new google.maps.Marker({ | |
position: { | |
lat: simplifiedMarker.lat, | |
lng: simplifiedMarker.lng |
View object-mutation-map.js
const events = [ | |
{ | |
name: 'First Event', | |
metadata: { | |
type: 'public' | |
} | |
}, { | |
name: 'Event 2', | |
metadata: { | |
type: 'private' |
View map.component.ts
import { Component, OnInit, AfterViewInit, ViewChild, ElementRef } from '@angular/core'; | |
import { MatSnackBar } from '@angular/material/snack-bar'; | |
import { SEOService } from '@services/seo.service'; | |
import { } from 'googlemaps'; | |
@Component({ | |
selector: 'app-map', | |
templateUrl: './map.component.html', | |
styleUrls: ['./map.component.scss'] | |
}) |
View vehicle.component.html
<!-- activity.vehicleId --> | |
<mat-form-field appearance="outline" class="full-width"> | |
<mat-chip-list #vehicleList aria-label="Araç Seç"> | |
<mat-chip *ngFor="let vehicle of vehicles" [selectable]="selectable" [removable]="removable" | |
(removed)="removeVehicle(vehicle)"> | |
{{ vehicle.plate }} | |
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon> | |
</mat-chip> | |
<input placeholder="Araç Ekle..." #vehicleInput (keyup)="vehicleSearch()" [formControl]="vehicleCtrl" | |
[matAutocomplete]="vehicleAuto" [matChipInputFor]="vehicleList" |
View enum.ts
import { Component, OnInit } from '@angular/core'; | |
import { MatSnackBar } from '@angular/material/snack-bar'; | |
import { CreateUserGQL, Roles, JobTitles, CreateUserProfileImageGQL } from '@generated-types'; | |
import { SEOService } from '@services/seo.service'; | |
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; | |
import { MustMatch } from '@helpers/must-match-validator'; | |
import * as uuid from 'uuid'; | |
interface Role { | |
value: string; |
View test.ts
onFileChanged(event: any) { | |
// dosyayı seç | |
this.selectedFile = event.target.files[0]; | |
// seçili resim yoksa dur!. | |
if (!this.selectedFile) { | |
return; | |
} | |
// seçilen resmin önizlemesini göstermek için | |
const fileReader = new FileReader(); | |
fileReader.readAsDataURL(this.selectedFile); |
View locale-date.module.ts
export class LocaleDateModule { | |
options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; | |
constructor() { } | |
getFutureDate(nextDay: number, locale: string, options: any): string { | |
const today = new Date(); | |
const future = new Date(today); | |
future.setDate(future.getDate() + nextDay); | |
const string = new Date(future).toLocaleDateString(locale, options); | |
console.log(string); // 17 Mayıs 2020 Pazar |
View typeorm-raw-query.ts
@FieldResolver(() => CategoryAndCount) | |
async turlerineGoreKitaplarveSayilari( | |
@Args() { skip, take }: Pagination, | |
@Arg('state', () => Int) state: number, | |
@Root() user: User | |
): Promise<CategoryAndCount[]> { | |
const userId = user.id; | |
// book_reading_status tablosu | |
// const bookReadingStatus = await this.bookReadingStatusRepository.find({ userId, readingStatus: state }); | |
// if (bookReadingStatus.length === 0) { return []; } |
View example.resolver.ts
// status argümanı boş gönderilirse null değil hi olmamış gibi query'e etki etmesi gerekirken null gidiyor. | |
// conditional query ya da if if gibi bir yapı kuramadım. | |
@FieldResolver() | |
async okuduguKitaplar( | |
@Args() { skip, take }: Pagination, | |
@Arg('status', () => Int, { nullable: true }) readingStatus: number, | |
@Root() user: User | |
): Promise<Book[]> { | |
const userId = user.id; | |
const relation = await this.bookReadingStatusRepository.find({ userId, readingStatus }); |
View book.resolver.ts
import { getRepository } from 'typeorm'; | |
import { Resolver, Query, Args, Arg, Mutation, Authorized, FieldResolver, Root, Ctx } from 'type-graphql'; | |
import { Book, BookFilter, BooksFilter, CreateBookInput } from './book.entity'; | |
import { Author, AuthorInput } from '../author/author.entity'; | |
import { Category, CategoryInput } from '../category/category.entity'; | |
import { AuthorBook } from '../author-book/author-book.entity'; | |
import { BookReadingStatus } from '../book-reading-status/book-reading-status.entity'; | |
import { BookLike } from '../book-like/book-like.entity'; | |
import { UserLibrary } from '../user-library/user-library.entity'; | |
import { BookRating } from '../book-rating/book-rating.entity'; |