Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3101088
feat(application): Add app-authorization module
LucienShui Sep 3, 2025
8df982e
chore(application): Add e2e test
LucienShui Sep 3, 2025
7e2f4e9
chore(application): Use postgres jsonb query instead of code
LucienShui Sep 3, 2025
eed2b07
feat(application): Remove e2e test, add BaseApp
LucienShui Sep 4, 2025
5ddc87c
feat(application): Add api-key creation
LucienShui Sep 4, 2025
c0b1238
refactor(application): Fix migration class name and route paths
LucienShui Sep 4, 2025
e1813f5
feat(application): Add findAll and findOne endpoints with improved au…
LucienShui Sep 4, 2025
bdd9ea8
fix(application): Fix bind
LucienShui Sep 4, 2025
f26cc15
refactor(wechat-bot): Improve callback response structure and error h…
LucienShui Sep 5, 2025
0bf0fca
feat(application): application runnable, optimize trace
LucienShui Sep 5, 2025
c8a900c
feat(application): Add postDelete hook and cleanup verify_code
LucienShui Sep 5, 2025
f267756
feat(application): Add api_key_id filtering to findAll endpoint
LucienShui Sep 5, 2025
89560bc
feat(application): Add soft delete with unique constraint handling
LucienShui Sep 6, 2025
f0b6f90
refactor: Use soft delete for API keys and remove redundant applicati…
LucienShui Sep 6, 2025
58182c4
feat(api-key): Add PATCH endpoint for partial API key updates
LucienShui Sep 6, 2025
fdbdf7a
fix(api-key): Add cascade delete for applications when API key is del…
LucienShui Sep 6, 2025
4d28708
chore(application): Replace get with appId instead of applicationId
LucienShui Sep 6, 2025
76612f4
chore(merge): Merge main
LucienShui Sep 7, 2025
9838ca6
feat(deploy): Add helm support
LucienShui Sep 7, 2025
57f1945
chore(deploy): Update helm
LucienShui Sep 7, 2025
1a9ead3
chore(mv): Move helm dir
LucienShui Sep 7, 2025
141037d
fix(api): Fix related_app_id lost after patch api-key
LucienShui Sep 8, 2025
c577659
Merge branch 'main' into feature/application
LucienShui Sep 8, 2025
0901bb6
chore(helm): Update helm
LucienShui Sep 8, 2025
1d26958
fix(api-key): Fix lost related_app_id during patch
LucienShui Sep 8, 2025
042fced
ci: update webhook
ycdzj Sep 9, 2025
6ea1460
ci: rename PR to TEST
ycdzj Sep 9, 2025
f6e0612
ci: update workflow
ycdzj Sep 10, 2025
ad1f83c
Merge branch 'main' into feature/application
LucienShui Sep 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ jobs:
run: |
curl "${{ secrets.DEV_WEBHOOK_URL }}/dev" -H "Authorization: Bearer ${{ secrets.DEV_WEBHOOK_API_KEY }}"

- name: PR Webhook
- name: TEST Webhook
if: github.event_name == 'pull_request'
run: |
curl "${{ secrets.DEV_WEBHOOK_URL }}/pr?module=backend&pr=pr-${{ github.event.number }}" -H "Authorization: Bearer ${{ secrets.DEV_WEBHOOK_API_KEY }}"
curl "${{ secrets.DEV_WEBHOOK_URL }}/test?module=backend&pr=pr-${{ github.event.number }}&commit=${{ github.event.pull_request.head.sha }}" -H "Authorization: Bearer ${{ secrets.DEV_WEBHOOK_API_KEY }}"

- name: PROD Webhook
if: false && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
Expand Down
23 changes: 23 additions & 0 deletions helm/backend/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
7 changes: 7 additions & 0 deletions helm/backend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: OmniBox Backend
description: OmniBox Backend Service

type: application
version: 0.1.0
appVersion: "0.1.0"
88 changes: 88 additions & 0 deletions helm/backend/templates/omnibox-backend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{{- $name := default .Release.Name .Values.release.name }}
{{- $namespace := default .Release.Namespace .Values.release.namespace }}

{{- if ne $name .Release.Name }}
{{ fail (printf "Name from command line not equal to config's: %s != %s" ($name | quote) (.Release.Name | quote)) }}
{{- end }}

{{- if ne $namespace .Release.Namespace }}
{{ fail (printf "Namespace from command line not equal to config's: %s != %s" ($namespace | quote) (.Release.Namespace | quote)) }}
{{- end }}

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $name }}
namespace: {{ $namespace }}
spec:
replicas: {{ .Values.replicas }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: {{ $name }}
template:
metadata:
labels:
app: {{ $name }}
spec:
restartPolicy: Always
containers:
- name: {{ $name }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: Always
ports:
- containerPort: {{ .Values.app.port }}
volumeMounts:
- name: localtime
mountPath: /etc/localtime
readOnly: true
envFrom:
- secretRef:
name: omnibox-secrets
readinessProbe:
httpGet:
path: /api/v1/health
port: {{ .Values.app.port }}
initialDelaySeconds: 15
periodSeconds: 10
livenessProbe:
tcpSocket:
port: {{ .Values.app.port }}
initialDelaySeconds: 15
periodSeconds: 10
resources:
requests:
cpu: 128m
memory: 256Mi
limits:
cpu: "1"
memory: 2Gi
volumes:
- name: localtime
hostPath:
path: /etc/localtime
type: File
{{ if .Values.nodeSelector }}
nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
{{ end }}
{{ if .Values.affinity }}
affinity: {{ toYaml .Values.affinity | nindent 8 }}
{{ end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ $name }}
namespace: {{ $namespace }}
spec:
selector:
app: {{ $name }}
ports:
- protocol: TCP
port: {{ .Values.app.port }}
targetPort: {{ .Values.app.port }}
type: ClusterIP
15 changes: 15 additions & 0 deletions helm/backend/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
release:
name: omnibox-backend
namespace:

image:
repository: ghcr.io/import-ai/omnibox-backend
tag: main

replicas: 1

app:
port: 8000

affinity: {}
nodeSelector: {}
10 changes: 10 additions & 0 deletions src/api-key/api-key.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
APIKeyResponseDto,
CreateAPIKeyDto,
UpdateAPIKeyDto,
PatchAPIKeyDto,
} from 'omniboxd/api-key/api-key.dto';
import {
BadRequestException,
Expand All @@ -11,6 +12,7 @@ import {
Delete,
Get,
Param,
Patch,
Post,
Put,
Query,
Expand Down Expand Up @@ -53,6 +55,14 @@ export class APIKeyController {
return await this.apiKeyService.update(id, updateApiKeyDto);
}

@Patch(':id')
async patch(
@Param('id') id: string,
@Body() patchApiKeyDto: PatchAPIKeyDto,
): Promise<APIKeyResponseDto> {
return await this.apiKeyService.patch(id, patchApiKeyDto);
}

@Delete(':id')
async delete(@Param('id') id: string): Promise<void> {
return await this.apiKeyService.delete(id);
Expand Down
36 changes: 34 additions & 2 deletions src/api-key/api-key.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { IsOptional, IsString, IsUUID, IsObject } from 'class-validator';
import { APIKeyAttrs } from './api-key.entity';
import {
IsOptional,
IsString,
IsUUID,
IsObject,
IsArray,
ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
import { APIKeyAttrs, APIKey, APIKeyPermission } from './api-key.entity';

export class CreateAPIKeyDto {
@IsString()
Expand All @@ -19,6 +27,18 @@ export class UpdateAPIKeyDto {
attrs?: APIKeyAttrs;
}

export class PatchAPIKeyDto {
@IsString()
@IsOptional()
root_resource_id?: string;

@IsArray()
@ValidateNested({ each: true })
@Type(() => Object)
@IsOptional()
permissions?: APIKeyPermission[];
}

export class APIKeyResponseDto {
@IsUUID()
id: string;
Expand All @@ -38,4 +58,16 @@ export class APIKeyResponseDto {
created_at: Date;

updated_at: Date;

static fromEntity(apiKey: APIKey): APIKeyResponseDto {
const dto = new APIKeyResponseDto();
dto.id = apiKey.id;
dto.value = apiKey.value;
dto.user_id = apiKey.userId;
dto.namespace_id = apiKey.namespaceId;
dto.attrs = apiKey.attrs;
dto.created_at = apiKey.createdAt;
dto.updated_at = apiKey.updatedAt;
return dto;
}
}
Loading