-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add grid view that allows to custom any fields you want (#265)
- add new view called grid - grid allows users to create custom field in multiple formats: text, number, date, select, multiselect, person, created_at, created_by, updated_at, updated_by - grid allows to filter dynamically
- Loading branch information
Showing
186 changed files
with
8,521 additions
and
507 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { FieldService } from '../../services/field' | ||
import { BaseJob } from '../BaseJob' | ||
|
||
interface ISortatbleFieldData { | ||
id: string | ||
order: number | ||
} | ||
|
||
export class FieldSortableJob extends BaseJob { | ||
name = 'fieldSortable' | ||
fieldService: FieldService | ||
constructor() { | ||
super() | ||
this.fieldService = new FieldService() | ||
} | ||
async implement(data: ISortatbleFieldData[]) { | ||
console.log('implement field sortable') | ||
await this.fieldService.sortable(data) | ||
console.log('finish implementation') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { FieldSortableJob } from './FieldSortableJob' | ||
import { BaseQueue } from '../BaseQueue' | ||
|
||
export class CommonQueue extends BaseQueue { | ||
constructor() { | ||
super() | ||
this.queueName = 'Common' | ||
this.jobs = [new FieldSortableJob()] | ||
|
||
this.run() | ||
} | ||
} | ||
|
||
let instance: CommonQueue = null | ||
|
||
export const getCommonQueueInstance = () => { | ||
if (!instance) { | ||
instance = new CommonQueue() | ||
} | ||
|
||
return instance | ||
} |
101 changes: 101 additions & 0 deletions
101
packages/be-gateway/src/routes/apps/index.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { | ||
BaseController, | ||
Body, | ||
Controller, | ||
Delete, | ||
Get, | ||
Post, | ||
Put, | ||
Req, | ||
UseMiddleware | ||
} from '../../core' | ||
import { authMiddleware } from '../../middlewares' | ||
import { ApplicationRepository } from '@shared/models' | ||
import { randomBytes } from 'crypto' | ||
import { AuthRequest } from '../../types' | ||
import { Application } from '@prisma/client' | ||
|
||
@Controller('/apps') | ||
@UseMiddleware([authMiddleware]) | ||
export class ApplicationController extends BaseController { | ||
private appRepo: ApplicationRepository | ||
|
||
constructor() { | ||
super() | ||
this.appRepo = new ApplicationRepository() | ||
} | ||
|
||
@Get('/:orgId') | ||
async getApps(@Req() req: AuthRequest) { | ||
const orgId = req.params.orgId | ||
|
||
if (!orgId) { | ||
throw new Error('Organization ID is required') | ||
} | ||
|
||
const apps = await this.appRepo.getByOrgId(orgId) | ||
return apps | ||
} | ||
|
||
@Post('') | ||
async create(@Req() req: AuthRequest, @Body() body: { name: string, desc?: string, orgId: string }) { | ||
const { name, desc, orgId } = body | ||
const { id: uid } = req.authen | ||
|
||
// Validate required fields | ||
if (!name || !orgId) { | ||
throw new Error('Name and Organization are required') | ||
} | ||
|
||
const clientId = randomBytes(8).toString('hex') | ||
const clientSecret = randomBytes(16).toString('hex') | ||
|
||
const result = await this.appRepo.create({ | ||
name, | ||
description: desc || '', | ||
organizationId: orgId, | ||
clientId, | ||
scopes: [], | ||
clientSecret, | ||
updatedBy: null, | ||
createdBy: uid, | ||
createdAt: new Date(), | ||
updatedAt: null | ||
}) | ||
|
||
return result | ||
} | ||
|
||
@Put('') | ||
async update(@Body() body: Application, @Req() req: AuthRequest) { | ||
const { id, ...rest } = body | ||
const { id: uid } = req.authen | ||
|
||
|
||
if (!id) { | ||
throw new Error('Application ID and status are required') | ||
} | ||
|
||
const result = await this.appRepo.update(id, { | ||
...rest, | ||
updatedBy: uid, | ||
updatedAt: new Date() | ||
}) | ||
|
||
return result | ||
} | ||
|
||
@Delete('/:id') | ||
async delete(@Req() req: AuthRequest) { | ||
const { id } = req.params | ||
|
||
console.log('1', id) | ||
|
||
if (!id) { | ||
throw new Error('Application ID is required') | ||
} | ||
|
||
const result = await this.appRepo.delete(id) | ||
return result | ||
} | ||
} |
Oops, something went wrong.