Skip to content

Instantly share code, notes, and snippets.

View Taofiqq's full-sized avatar
🎯
Focusing

Taofiq Aiyelabegan Taofiqq

🎯
Focusing
View GitHub Profile
import os
import json
import re
from typing import Dict, List, Any
from crewai import Agent, Crew, Task, Process
from langchain_openai import OpenAI
from copilotkit import CopilotKitState
class FeedbackAnalyzerState(CopilotKitState):
@Taofiqq
Taofiqq / tenant-aware.entity.ts
Created December 31, 2024 22:30
Tenant Module
import { Column } from 'typeorm';
export class TenantAwareEntity {
@Column()
tenantId: string;
}
@Taofiqq
Taofiqq / app.controller.ts
Created December 31, 2024 22:26
Configuring the database in a multi-tenant e-commerce API using Nest.js.
import { Controller, Get } from '@nestjs/common';
import { DataSource } from 'typeorm';
import { InjectDataSource } from '@nestjs/typeorm';
@Controller()
export class AppController {
constructor(
@InjectDataSource() private dataSource: DataSource,
) {}
@Taofiqq
Taofiqq / order.controller.ts
Created December 31, 2024 22:24
Orders Module
import { Controller, Post, Get, Param, Body } from '@nestjs/common';
import { OrderService } from './order.service';
import { CreateOrderDto } from './order.dto';
import { CurrentTenant } from '../tenants/tenant.decorator';
import { Tenant } from '../tenants/tenant.entity';
@Controller('orders')
export class OrderController {
constructor(private readonly orderService: OrderService) {}
@Taofiqq
Taofiqq / product.controller.ts
Created December 31, 2024 21:01
Product Module - MultiTenant Ecommerce API
import {
Controller,
Get,
Post,
Body,
Param,
Delete,
UseGuards,
} from '@nestjs/common';
import { ProductService } from './product.service';
@Taofiqq
Taofiqq / create-user.dto.ts
Created December 31, 2024 20:21
User Module - Multi Tenant E-commerce API
import { IsEmail, IsString } from 'class-validator';
export class CreateUserDto {
@IsEmail()
email: string;
@IsString()
firstName: string;
@IsString()
@Taofiqq
Taofiqq / auth.controller.ts
Created December 31, 2024 20:01
A gist for Auth Module - Multi Tenant E-commerce API
import { Controller, Post, Body } from '@nestjs/common';
import { AuthService } from './auth.service';
import { LoginDto } from './dto/login.dto';
import { RegisterTenantDto } from './dto/register-tenant.dto';
@Controller('auth')
export class AuthController {
constructor(private readonly authService: AuthService) {}
@Post('register-tenant')
@Taofiqq
Taofiqq / folder-structure.md
Created December 31, 2024 16:38
Folder structure for a multi-tenant e-commerce API using NestJS with role-based access control and Permit.io integration.
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”œβ”€β”€ auth.controller.ts
β”‚   β”‚   β”œβ”€β”€ auth.module.ts
β”‚   β”‚   β”œβ”€β”€ auth.service.ts
β”‚   β”‚   β”œβ”€β”€ jwt.strategy.ts
β”‚   β”‚   β”œβ”€β”€ dto/
β”‚   β”‚   β”‚   β”œβ”€β”€ login.dto.ts
β”‚   β”‚   β”‚   └── register-tenant.dto.ts
@Taofiqq
Taofiqq / NavbarHook.css
Created February 5, 2024 09:37
This is a CSS file for the NavbarHook.js code, where the link to this gist was attached.
.header {
position: fixed;
width: 100%;
top: 0;
left: 0;
background-color: transparent;
z-index: var(--z-fixed);
}
.nav {
@Taofiqq
Taofiqq / Footer.js
Last active August 2, 2022 02:59
Navbar and Footer Component