Skip to content

Instantly share code, notes, and snippets.

View umutyerebakmaz's full-sized avatar
:octocat:
I'm available, please open an issue on the subject.

Umut Yerebakmaz umutyerebakmaz

:octocat:
I'm available, please open an issue on the subject.
View GitHub Profile
@umutyerebakmaz
umutyerebakmaz / user.entity.ts
Last active January 17, 2020 09:37
TypeORM ManyToMany Kullanımı.
import { Entity,
PrimaryGeneratedColumn,
Column,
BaseEntity,
OneToMany,
CreateDateColumn,
UpdateDateColumn,
ManyToMany,
JoinTable,
OneToOne } from 'typeorm';
@umutyerebakmaz
umutyerebakmaz / user.resolver.ts
Last active January 17, 2020 10:23
TypeORM ManyToMany Kullanımı.
import { Resolver, Mutation, Arg } from 'type-graphql';
import { User } from './user.entity';
import { UserAuthorLike } from '../user-author-like/user-author-like.entity';
@Resolver(User)
export class UserResolver {
// yazar beğen
@Mutation(() => Boolean)
async yazarBegen(
@Arg('userId') userId: string,
@umutyerebakmaz
umutyerebakmaz / author.entity.ts
Created January 17, 2020 09:43
TypeORM ManyToMany Kullanımı.
import { Entity, PrimaryGeneratedColumn, Column, BaseEntity, ManyToMany } from 'typeorm';
import { ObjectType, Field, ID } from 'type-graphql';
import { User } from '../user/user.entity';
@Entity()
@ObjectType()
export class Author extends BaseEntity {
@PrimaryGeneratedColumn("uuid")
@umutyerebakmaz
umutyerebakmaz / user-author-like.entity.ts
Created January 17, 2020 09:47
TypeORM ManyToMany Kullanımı.
import { BaseEntity, PrimaryColumn, Entity, CreateDateColumn } from 'typeorm';
@Entity()
export class UserAuthorLike extends BaseEntity {
@PrimaryColumn('uuid')
userId: string;
@PrimaryColumn('uuid')
authorId: string;
@umutyerebakmaz
umutyerebakmaz / user-author-like.resolver.ts
Created January 20, 2020 12:17
TypeORM ManyToMany Örnek
import { Resolver, Authorized, Mutation, Arg } from 'type-graphql';
import { UserAuthorLike } from './user-author-like.entity';
@Resolver()
export class UserAuthorLikeResolver {
@Authorized('ADMIN', 'MODERATOR', 'MEMBER')
@Mutation(() => Boolean)
async yazarBegen(
@Arg('userId') userId: string,
<div class="author-up container" fxLayoutAlign="row" *ngIf="author">
<div class="image-area" *ngIf="author.image !== null">
<img src="http://localhost:4000/images/authors/{{ author.image }}" alt="{{ author.title }}">
</div>
<div class="image-area" *ngIf="author.image === null">
<img class="author-default-image" src="http://localhost:4000/images/authors/default-author.png"
alt="Author Default Image">
</div>
@umutyerebakmaz
umutyerebakmaz / array-element-by-index.ts
Created February 10, 2020 23:33
Get the array element by index
toolTips = ['Kötü', 'Orta', 'İyi', 'Çok İyi', 'Mükemmel'];
getTooltip(index: number): string {
return this.toolTips[index];
}
<button mat-icon-button
*ngFor="let ratingId of ratingArr; index as i" [id]="'star_'+i"
(click)="onClick(i+1)"
[matTooltip]="getTooltip(ratingId)"
matTooltipPosition="above">
@umutyerebakmaz
umutyerebakmaz / user-nav-one.component.html
Created February 25, 2020 09:01
RouterLinkActiveOptions usage example
<div *ngIf="user" fxLayout="row" fxLayoutAlign="center none">
<div class="user-nav-one mat-elevation-z2" fxLayout="row" fxLayoutAlign="space-between none">
<a mat-button routerLink="/okur/{{ user.slug }}" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Duvar <span>0</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/kitaplari" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Kitapları <span>173</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/takip-ettikleri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Takip Ettikleri <span>971</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/takipcileri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Takipçileri <span>1.362</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/begendikleri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Beğendikleri <span>156</span></a>
<a mat-button rout
@umutyerebakmaz
umutyerebakmaz / user-nav-one.component.html
Created February 25, 2020 09:01
RouterLinkActiveOptions usage example
<div *ngIf="user" fxLayout="row" fxLayoutAlign="center none">
<div class="user-nav-one mat-elevation-z2" fxLayout="row" fxLayoutAlign="space-between none">
<a mat-button routerLink="/okur/{{ user.slug }}" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Duvar <span>0</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/kitaplari" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Kitapları <span>173</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/takip-ettikleri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Takip Ettikleri <span>971</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/takipcileri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Takipçileri <span>1.362</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/begendikleri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Beğendikleri <span>156</span></a>
<a mat-button rout
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { UserUserQuery, UserUserGQL, LoginMeQuery, LoginMeGQL } from '@generated-types';
import { SEOService } from '@services/seo.service';
import { FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { fas, faCoffee } from '@fortawesome/free-solid-svg-icons';
import { far } from '@fortawesome/free-regular-svg-icons';
import { fab } from '@fortawesome/free-brands-svg-icons';
import { Observable, Subscription } from 'rxjs';
import { map } from 'rxjs/operators';