Skip to content

Commit

Permalink
update orval
Browse files Browse the repository at this point in the history
  • Loading branch information
danicc097 committed Jun 13, 2024
1 parent f4ab104 commit b551ee9
Show file tree
Hide file tree
Showing 151 changed files with 834 additions and 518 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"moment": "^2.29.4",
"msw": "^2.2.1",
"openapi-typescript": "^6.4.3",
"orval": "^6.25.0",
"orval": "6.30.2",
"postcss": "^8.4.24",
"postcss-preset-mantine": "1.9.0",
"postcss-simple-vars": "^7.0.1",
Expand Down
102 changes: 63 additions & 39 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 22 additions & 20 deletions frontend/src/gen/activity/activity.msw.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type * as EntityIDs from 'src/gen/entity-ids'
/**
* Generated by orval v6.25.0 🍺
* Generated by orval v6.30.2 🍺
* Do not edit manually.
* OpenAPI openapi-go-gin-postgres-sqlc
* openapi-go-gin-postgres-sqlc
Expand All @@ -18,19 +18,20 @@ import type {
ActivityResponse
} from '.././model'

export const getCreateActivityResponseMock = (overrideResponse: any = {}): ActivityResponse => ({activityID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ActivityID, deletedAt: faker.helpers.arrayElement([(() => faker.date.past())(), null]), description: faker.word.sample(), isProductive: faker.datatype.boolean(), name: faker.word.sample(), projectID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ProjectID, ...overrideResponse})
export const getCreateActivityResponseMock = (overrideResponse: Partial< ActivityResponse > = {}): ActivityResponse => ({activityID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ActivityID, deletedAt: faker.helpers.arrayElement([(() => faker.date.past())(), null]), description: faker.word.sample(), isProductive: faker.datatype.boolean(), name: faker.word.sample(), projectID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ProjectID, ...overrideResponse})

export const getGetActivityResponseMock = (overrideResponse: any = {}): ActivityResponse => ({activityID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ActivityID, deletedAt: faker.helpers.arrayElement([(() => faker.date.past())(), null]), description: faker.word.sample(), isProductive: faker.datatype.boolean(), name: faker.word.sample(), projectID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ProjectID, ...overrideResponse})
export const getGetActivityResponseMock = (overrideResponse: Partial< ActivityResponse > = {}): ActivityResponse => ({activityID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ActivityID, deletedAt: faker.helpers.arrayElement([(() => faker.date.past())(), null]), description: faker.word.sample(), isProductive: faker.datatype.boolean(), name: faker.word.sample(), projectID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ProjectID, ...overrideResponse})

export const getUpdateActivityResponseMock = (overrideResponse: any = {}): ActivityResponse => ({activityID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ActivityID, deletedAt: faker.helpers.arrayElement([(() => faker.date.past())(), null]), description: faker.word.sample(), isProductive: faker.datatype.boolean(), name: faker.word.sample(), projectID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ProjectID, ...overrideResponse})
export const getUpdateActivityResponseMock = (overrideResponse: Partial< ActivityResponse > = {}): ActivityResponse => ({activityID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ActivityID, deletedAt: faker.helpers.arrayElement([(() => faker.date.past())(), null]), description: faker.word.sample(), isProductive: faker.datatype.boolean(), name: faker.word.sample(), projectID: faker.number.int({min: undefined, max: undefined}) as EntityIDs.ProjectID, ...overrideResponse})


export const getCreateActivityMockHandler = (overrideResponse?: ActivityResponse) => {
return http.post('*/project/:projectName/activity/', async () => {
await delay(200);
return new HttpResponse(JSON.stringify(overrideResponse ? overrideResponse : getCreateActivityResponseMock()),
export const getCreateActivityMockHandler = (overrideResponse?: ActivityResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<ActivityResponse> | ActivityResponse)) => {
return http.post('*/project/:projectName/activity/', async (info) => {await delay(200);
return new HttpResponse(JSON.stringify(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getCreateActivityResponseMock()),
{
status: 200,
status: 201,
headers: {
'Content-Type': 'application/json',
}
Expand All @@ -39,10 +40,11 @@ export const getCreateActivityMockHandler = (overrideResponse?: ActivityResponse
})
}

export const getGetActivityMockHandler = (overrideResponse?: ActivityResponse) => {
return http.get('*/activity/:activityID', async () => {
await delay(200);
return new HttpResponse(JSON.stringify(overrideResponse ? overrideResponse : getGetActivityResponseMock()),
export const getGetActivityMockHandler = (overrideResponse?: ActivityResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<ActivityResponse> | ActivityResponse)) => {
return http.get('*/activity/:activityID', async (info) => {await delay(200);
return new HttpResponse(JSON.stringify(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getGetActivityResponseMock()),
{
status: 200,
headers: {
Expand All @@ -53,10 +55,11 @@ export const getGetActivityMockHandler = (overrideResponse?: ActivityResponse) =
})
}

export const getUpdateActivityMockHandler = (overrideResponse?: ActivityResponse) => {
return http.patch('*/activity/:activityID', async () => {
await delay(200);
return new HttpResponse(JSON.stringify(overrideResponse ? overrideResponse : getUpdateActivityResponseMock()),
export const getUpdateActivityMockHandler = (overrideResponse?: ActivityResponse | ((info: Parameters<Parameters<typeof http.patch>[1]>[0]) => Promise<ActivityResponse> | ActivityResponse)) => {
return http.patch('*/activity/:activityID', async (info) => {await delay(200);
return new HttpResponse(JSON.stringify(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getUpdateActivityResponseMock()),
{
status: 200,
headers: {
Expand All @@ -68,11 +71,10 @@ export const getUpdateActivityMockHandler = (overrideResponse?: ActivityResponse
}

export const getDeleteActivityMockHandler = () => {
return http.delete('*/activity/:activityID', async () => {
await delay(200);
return http.delete('*/activity/:activityID', async () => {await delay(200);
return new HttpResponse(null,
{
status: 200,
status: 204,
headers: {
'Content-Type': 'application/json',
}
Expand Down
Loading

0 comments on commit b551ee9

Please sign in to comment.