Skip to content

Commit 5242858

Browse files
committed
Update limitation names and fix max model data issue
1 parent e9a8580 commit 5242858

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

server/routes/models/[id]/model-data.post.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type FakeSchema = {
1212

1313
type BodyParams = {
1414
apiKey: string;
15-
increase: number;
15+
increase: string;
1616
schema: FakeSchema[];
1717
};
1818

@@ -27,7 +27,7 @@ export default defineEventHandler(async (event) => {
2727

2828
const currentTotal = await new ModelDataServices(event).count(model.id);
2929

30-
if (currentTotal + body.increase > MAX_RESOURCE_DATA_ALLOWED) {
30+
if (currentTotal + Number(body.increase) > MAX_MODEL_DATA_ALLOWED) {
3131
throw ErrorResponse.badRequest(
3232
'You have exceeded the allowed number of Model Data for this Model.'
3333
);

server/services/appServices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default class AppServices extends SupabaseService {
123123
}) {
124124
const list = await this.list();
125125

126-
if (list.length === MAX_PROJECTS_ALLOWED) {
126+
if (list.length === MAX_APPS_ALLOWED) {
127127
throw ErrorResponse.badRequest(
128128
'You have exceeded the allowed number of Apps.'
129129
);

server/services/modelServices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export default class ModelServices extends SupabaseService {
131131
async createUnique(params: { name: string; appId: string; schema: Schema }) {
132132
const list = await this.list(params.appId);
133133

134-
if (list.length >= MAX_RESOURCE_MODELS_ALLOWED) {
134+
if (list.length >= MAX_MODELS_ALLOWED) {
135135
throw ErrorResponse.badRequest(
136136
'You have exceeded the allowed number of Models.'
137137
);

server/utils/limitations.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export const MAX_APIS_ALLOWED = 5;
2-
export const MAX_PROJECTS_ALLOWED = 2;
3-
export const MAX_RESOURCE_MODELS_ALLOWED = 5;
4-
export const MAX_RESOURCE_DATA_ALLOWED = 10;
1+
export const MAX_APPS_ALLOWED = 2;
2+
export const MAX_MODELS_ALLOWED = 5;
3+
export const MAX_MODEL_DATA_ALLOWED = 10;

stores/useModelData.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ export default defineStore('model-data', () => {
8080

8181
await refresh();
8282
}
83+
84+
if (response.status === 400) {
85+
toast.error(response._data.statusMessage);
86+
}
8387
},
8488
});
8589
};

0 commit comments

Comments
 (0)