Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: FossFolio v2 #160

Merged
merged 66 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
18921a8
feat: backend refactor
DarkPhoenix2704 Jun 1, 2024
32950ec
feat: support orderBy in BaseModel
DarkPhoenix2704 Jun 2, 2024
37fe03b
feat: global error filter
DarkPhoenix2704 Jun 2, 2024
9febd4b
chore: format
DarkPhoenix2704 Jun 2, 2024
d9bde50
fix: type errors
DarkPhoenix2704 Jun 2, 2024
cd307dc
fix: move to zod and new types
DarkPhoenix2704 Jun 2, 2024
0a1c577
fix: some migration to new models
DarkPhoenix2704 Jun 2, 2024
cf7a81b
fix: remove direct usage of process.env
DarkPhoenix2704 Jun 2, 2024
2df5583
feat: support rawQuery and dangerous Raw Query in BaseContext and Bas…
DarkPhoenix2704 Jun 2, 2024
7067071
feat(wip): migrating to new controllers
DarkPhoenix2704 Jun 4, 2024
5d216b9
fix: ts error and few knex orm
sreehari2003 Jun 5, 2024
76faa07
fix: format and lint
sreehari2003 Jun 5, 2024
dbae845
fix: removed stripe services
sreehari2003 Jun 7, 2024
1afff35
fix: biome format
sreehari2003 Jun 7, 2024
fe2cbe8
fix: org service"
sreehari2003 Jun 7, 2024
d4e6a37
fix: knex find by id error
sreehari2003 Jun 7, 2024
e8097f3
fix: changed user info types
sreehari2003 Jun 7, 2024
572cbf5
chore: bump version
sreehari2003 Jun 7, 2024
141d49a
feat: org client and server refactor
sreehari2003 Jun 8, 2024
1a39140
fix: org events api
sreehari2003 Jun 9, 2024
5a6a90e
fix: added debugger into script
sreehari2003 Jun 9, 2024
018a840
fix: tickets tabs
sreehari2003 Jun 12, 2024
1dbcf54
feat: added get eveny by slug
sreehari2003 Jun 12, 2024
f2543c8
feat: org events api
sreehari2003 Jun 12, 2024
b9c93bf
feat: org settings api and ui
sreehari2003 Jun 13, 2024
4aea8cf
feat: org settings api and ui
sreehari2003 Jun 13, 2024
7017201
fix: org invite service
sreehari2003 Jun 13, 2024
b34b8c5
fix: create org tooltip
sreehari2003 Jun 13, 2024
c8037fa
feat: events image upload
sreehari2003 Jun 14, 2024
5210670
fix: orgs and event refactor
sreehari2003 Jun 15, 2024
73f78aa
feat: user update , swagger and org participants
sreehari2003 Jun 16, 2024
180b92e
Merge pull request #162 from foss-labs/fix/org
DarkPhoenix2704 Jun 16, 2024
7d7dba7
feat: added tiptap editor (WIP)
sreehari2003 Jun 17, 2024
120b64b
feat: added manage forms page
sreehari2003 Jun 18, 2024
b71ad2d
fix: spelling mistakes
sreehari2003 Jun 18, 2024
686eadf
fix: preloader and submission count
sreehari2003 Jun 19, 2024
f12ced6
fix: form submission count
sreehari2003 Jun 19, 2024
0e5637d
Merge pull request #164 from foss-labs/fix/editor
DarkPhoenix2704 Jun 19, 2024
7a9b325
feat: google oauth for mobile
sreehari2003 Jun 20, 2024
cea812b
feat: added supprt for mobile auth
sreehari2003 Jun 21, 2024
7e95b24
feat: added form builder
sreehari2003 Jun 21, 2024
1111ae1
feat: added zustand for form builder
sreehari2003 Jun 22, 2024
8f611ee
feat: added ui to add options
sreehari2003 Jun 22, 2024
30d061e
fix: default value
sreehari2003 Jun 23, 2024
fa5060e
fix: lint
sreehari2003 Jun 23, 2024
d2900f0
Merge pull request #165 from foss-labs/fix/mobile
sreehari2003 Jun 23, 2024
138f773
fix: lint and kanban dnd
sreehari2003 Jun 23, 2024
6fb27a2
feat: added support to edit field
sreehari2003 Jun 23, 2024
4767d9f
fix: removed try catch
sreehari2003 Jun 23, 2024
1d0c40b
feat: ability to add new form
sreehari2003 Jun 24, 2024
8907b40
fix: rename pk -> eventid
sreehari2003 Jun 24, 2024
4df7643
feat: added support for single/multi select
sreehari2003 Jun 25, 2024
8ccfc77
feat: added support for cover image
sreehari2003 Jun 26, 2024
eaef5f2
fix: disable builder in mobile view
sreehari2003 Jun 26, 2024
4298432
feat: added support to update form description
sreehari2003 Jun 26, 2024
6a06237
fix: some fixes
DarkPhoenix2704 Jun 27, 2024
73c9d80
fix: selection ui and absolute postion
sreehari2003 Jun 27, 2024
653ca4f
minor fix
DarkPhoenix2704 Jun 27, 2024
d96438a
minor fix
DarkPhoenix2704 Jun 27, 2024
4df475a
Merge pull request #166 from foss-labs/fix/form-kanban
DarkPhoenix2704 Jun 27, 2024
741563b
fix: views folder restructure and issue with editor
sreehari2003 Jun 27, 2024
1689ada
feat: added support for faq
sreehari2003 Jul 7, 2024
cbf063c
feat: added support for faq
sreehari2003 Jul 7, 2024
0da0820
Merge pull request #167 from foss-labs/fix/events
DarkPhoenix2704 Jul 7, 2024
1abecae
feat: added knban get
sreehari2003 Jul 26, 2024
275cebc
feat: added kanban get
sreehari2003 Jul 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 0 additions & 4 deletions .eslintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ tmp
.pnp.js
/dist

apps/api/dist
apps/api/prisma/seed.js

# testing
/coverage

Expand Down
8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Anbarasu
Copyright (c) 2024 FossLabs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 0 additions & 1 deletion apps/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_SCOPE=user:email

RESEND_KEY = ""
SESSION_SECRET=secret
JWT_SECRET=secret
DATABASE_URL=postgres://fossfolio:fossfolio@localhost:5432/fossfolio
Expand Down
4 changes: 0 additions & 4 deletions apps/api/.gitignore

This file was deleted.

12 changes: 12 additions & 0 deletions apps/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node

RUN npm install -g pnpm

COPY package.json package.json
COPY .env .env
COPY src src

RUN pnpm install
RUN pnpm run start

ENTRYPOINT ["pnpm", "start:prod"]
39 changes: 39 additions & 0 deletions apps/api/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.0/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"security": {
"recommended": true
},
"complexity": {
"noThisInStatic": "off"
},
"performance": {
"recommended": true
},
"style": {
"useImportType": "off"
}
}
},
"javascript": {
"parser": {
"unsafeParameterDecoratorsEnabled": true
},
"formatter": {
"enabled": true,
"semicolons": "always",
"quoteStyle": "single"
}
},
"json": {
"formatter": {
"trailingCommas": "none"
}
}
}
38 changes: 23 additions & 15 deletions apps/api/nest-cli.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"builder": {
"type": "swc",
"options": {
"extensions": [".jsx", ".tsx", ".js", ".ts"]
}
},
"typeCheck": true,
"deleteOutDir": true,
"assets": ["mail/templates/**/*"],
"watchAssets": true
}
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"builder": {
"type": "swc",
"options": {
"extensions": [".jsx", ".tsx", ".js", ".ts"]
}
},
"jsc": {
"parser": {
"syntax": "typescript",
"decorators": true,
"tsx": true,
"dynamicImport": true
}
},
"typeCheck": true,
"deleteOutDir": true,
"assets": ["mail/templates/**/*"],
"watchAssets": true
}
}
163 changes: 81 additions & 82 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,84 +1,83 @@
{
"name": "api",
"version": "1.0.0",
"license": "UNLICENSED",
"private": true,
"scripts": {
"prebuild": "rimraf dist",
"build": "npx prisma generate && nest build",
"start": "nest start",
"nest:dev": "nest start --watch --debug | pino-pretty",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"format": "prettier --write \"{src,apps,libs,test}/**/*.ts\"",
"db:generate": "prisma generate",
"db:migrate-deploy": "prisma migrate deploy --schema ./prisma/schema.prisma",
"db:studio": "prisma studio",
"db:migrate": "prisma migrate dev",
"dev": "concurrently \"pnpm --filter api nest:dev\" \"pnpm --filter api db:studio\"",
"email": "email dev",
"db:seed": "ts-node prisma/seed.ts"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.521.0",
"@nestjs-modules/mailer": "^1.11.0",
"@nestjs/common": "^10.3.3",
"@nestjs/config": "^3.2.0",
"@nestjs/core": "^10.3.3",
"@nestjs/event-emitter": "^2.0.4",
"@nestjs/jwt": "^10.2.0",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.3.3",
"@nestjs/schematics": "^10.1.1",
"@nestjs/swagger": "^7.3.0",
"@nestjs/throttler": "^5.1.2",
"@node-saml/passport-saml": "^5.0.0",
"@prisma/client": "^5.10.2",
"@webtre/nestjs-mailer-react-adapter": "^0.1.2",
"argon2": "^0.40.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"cookie-parser": "^1.4.6",
"express": "^4.19.2",
"express-session": "^1.18.0",
"joi": "^17.12.2",
"nestjs-pino": "^4.0.0",
"nodemailer": "^6.9.10",
"openai": "^4.33.0",
"passport": "^0.7.0",
"passport-github2": "^0.1.12",
"passport-google-oauth20": "^2.0.0",
"passport-jwt": "^4.0.1",
"pino-http": "^9.0.0",
"pino-pretty": "^10.3.1",
"prisma-dbml-generator": "^0.12.0",
"reflect-metadata": "^0.2.1",
"rimraf": "^5.0.5",
"rxjs": "^7.8.1",
"stripe": "^14.18.0",
"zod": "^3.22.4",
"zod-to-json-schema": "^3.22.5"
},
"devDependencies": {
"@faker-js/faker": "^8.4.1",
"@nestjs/cli": "^10.3.2",
"@react-email/components": "^0.0.15",
"@swc/cli": "^0.3.9",
"@swc/core": "^1.4.2",
"@types/cookie-parser": "^1.4.6",
"@types/express": "^4.17.21",
"@types/multer": "^1.4.11",
"@types/node": "^20.11.20",
"@types/nodemailer": "^6.4.14",
"@types/passport": "^1.0.16",
"@types/passport-github2": "^1.2.9",
"@types/passport-google-oauth20": "^2.0.14",
"@types/passport-jwt": "^4.0.1",
"@types/react": "^18.2.58",
"concurrently": "^8.2.2",
"prisma": "^5.10.2",
"react": "^18.2.0",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
}
"name": "api",
"version": "1.0.0",
"license": "UNLICENSED",
"private": true,
"type": "commonjs",
"scripts": {
"prebuild": "rimraf dist",
"start": "nest start",
"dev": "node --inspect --watch -r '@swc-node/register' --enable-source-maps src/main.ts | pino-pretty",
"dev-new": "concurrently \"tsc --noEmit --watch\" \"node -r '@swc-node/register' --watch --enable-source-maps src/main.ts | pino-pretty \"",
"start:prod": "node dist/main",
"lint": "biome lint --error-on-warnings ./src",
"format": "npx @biomejs/biome format --write ./src"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.521.0",
"@nestjs-modules/mailer": "^2.0.2",
"@nestjs/common": "^10.3.3",
"@nestjs/config": "^3.2.0",
"@nestjs/core": "^10.3.3",
"@nestjs/event-emitter": "^2.0.4",
"@nestjs/jwt": "^10.2.0",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.3.3",
"@nestjs/schematics": "^10.1.1",
"@nestjs/swagger": "^7.3.0",
"@nestjs/throttler": "^5.1.2",
"@prisma/client": "^5.10.2",
"@webtre/nestjs-mailer-react-adapter": "^0.1.2",
"argon2": "^0.40.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"cookie-parser": "^1.4.6",
"express": "^4.19.2",
"express-session": "^1.18.0",
"google-auth-library": "^9.11.0",
"joi": "^17.12.2",
"knex": "^3.1.0",
"nanoid": "^3.3.4",
"nestjs-pino": "^4.0.0",
"nodemailer": "^6.9.10",
"openai": "^4.33.0",
"passport": "^0.7.0",
"passport-github2": "^0.1.12",
"passport-google-oauth20": "^2.0.0",
"passport-jwt": "^4.0.1",
"pg": "^8.11.5",
"pino-http": "^9.0.0",
"pino-pretty": "^10.3.1",
"prisma-dbml-generator": "^0.12.0",
"reflect-metadata": "^0.2.1",
"rimraf": "^5.0.5",
"rxjs": "^7.8.1",
"stripe": "^14.18.0",
"zod": "^3.22.4",
"zod-to-json-schema": "^3.22.5"
},
"devDependencies": {
"@biomejs/biome": "^1.7.3",
"@faker-js/faker": "^8.4.1",
"@nestjs/cli": "^10.3.2",
"@react-email/components": "^0.0.15",
"@swc-node/register": "^1.9.1",
"@swc/cli": "^0.3.9",
"@swc/core": "^1.4.2",
"@types/cookie-parser": "^1.4.6",
"@types/express": "^4.17.21",
"@types/multer": "^1.4.11",
"@types/node": "^20.11.20",
"@types/nodemailer": "^6.4.14",
"@types/passport": "^1.0.16",
"@types/passport-github2": "^1.2.9",
"@types/passport-google-oauth20": "^2.0.14",
"@types/passport-jwt": "^4.0.1",
"@types/react": "^18.2.58",
"concurrently": "^8.2.2",
"prisma": "^5.10.2",
"react": "^18.3.1",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
}
}
84 changes: 84 additions & 0 deletions apps/api/src/BaseContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import type { Knex } from 'knex';
import knex from 'knex';
import { Logger } from '@nestjs/common';
import { SystemTable } from '@api/utils/db';
import { ConfigService } from '@nestjs/config';
import { FFError } from '@api/utils/error';

export default class BaseContext {
public static knex: Knex;
public static config: ConfigService;
private static readonly logger = new Logger(BaseContext.name);

public static async init(_config: ConfigService) {
this.config = _config;

BaseContext.knex = knex({
client: 'pg',
connection: {
host: this.config.get('DB_HOST'),
user: this.config.get('DB_USER'),
password: this.config.get('DB_PASSWORD'),
database: this.config.get('DB_NAME'),
},
migrations: {
tableName: SystemTable.FF_Migrations,
directory: 'src/db/migrations',
},
});

BaseContext.logger.log('Starting Migration process...');

await BaseContext.knex.migrate.latest();

BaseContext.logger.log('Migration process completed.');
}

public async destroy() {
await BaseContext.knex.destroy();
}

public async getTransaction() {
return BaseContext.knex.transaction();
}

public async commitTransaction(trx: Knex.Transaction) {
await trx.commit();
}

public async rollbackTransaction(trx: Knex.Transaction) {
await trx.rollback();
}

public async execRawQuery(query: string, trx?: Knex.Transaction) {
if (!query.toLowerCase().includes('where')) {
throw new Error(
'Raw query must contain a where clause. For unrestricted usage, use BaseContext.knex.raw()',
);
}
try {
return await (trx ?? BaseContext.knex).raw(query);
} catch (error: unknown) {
BaseContext.logger.error(
`BaseContext: RawQuery Failed : ${query} `,
error,
);
FFError.databaseError(`BaseContext: RawQuery Failed : ${query} `, error);
}
}

public async dangerousExecRawQuery(query: string, trx?: Knex.Transaction) {
try {
return await (trx ?? BaseContext.knex).raw(query);
} catch (error: unknown) {
BaseContext.logger.error(
`BaseContext: DangerousExecRawQuery Failed : ${query} `,
error,
);
FFError.databaseError(
'BaseContext: DangerousExecRawQuery Failed : ',
error,
);
}
}
}
Loading
Loading