Skip to content

Commit

Permalink
feat: adding cars with server actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Wojtazzzz committed Nov 7, 2024
1 parent 4982cc9 commit f989b29
Show file tree
Hide file tree
Showing 16 changed files with 566 additions and 640 deletions.
5 changes: 5 additions & 0 deletions gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ import * as types from './graphql';
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
"mutation CreateCar($name: String!, $vin: String!) {\n createCar(params: {name: $name, vin: $vin}) {\n created\n }\n}": types.CreateCarDocument,
"query GetUserCars($limit: Int!) {\n getUserCars(params: {limit: $limit}) {\n cars {\n ...UserCar\n }\n }\n}\n\nfragment UserCar on Car {\n id\n name\n vin\n weight\n Insurance {\n id\n expiredAt\n }\n PeriodicService {\n id\n expiredAt\n }\n}": types.GetUserCarsDocument,
"query GetCarServices($carId: Int, $limit: Int) {\n getCarServices(params: {carId: $carId, limit: $limit}) {\n services {\n id\n name\n createdAt\n }\n }\n}": types.GetCarServicesDocument,
"mutation VerifyUser {\n verify {\n authorized\n }\n}": types.VerifyUserDocument,
};

/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "mutation CreateCar($name: String!, $vin: String!) {\n createCar(params: {name: $name, vin: $vin}) {\n created\n }\n}"): typeof import('./graphql').CreateCarDocument;
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
31 changes: 31 additions & 0 deletions gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ export type Car = {
weight: Scalars['Int']['output'];
};

export type CreateCarRequest = {
name: Scalars['String']['input'];
vin: Scalars['String']['input'];
};

export type CreateCarResponse = {
__typename?: 'CreateCarResponse';
created: Scalars['Boolean']['output'];
};

export type GetCarServicesRequest = {
carId?: InputMaybe<Scalars['Int']['input']>;
limit?: InputMaybe<Scalars['Int']['input']>;
Expand Down Expand Up @@ -58,9 +68,15 @@ export type Insurance = {

export type Mutation = {
__typename?: 'Mutation';
createCar: CreateCarResponse;
verify: AuthUserVerification;
};


export type MutationCreateCarArgs = {
params: CreateCarRequest;
};

export type PeriodicService = {
__typename?: 'PeriodicService';
expiredAt: Scalars['String']['output'];
Expand Down Expand Up @@ -90,6 +106,14 @@ export type Service = {
name: Scalars['String']['output'];
};

export type CreateCarMutationVariables = Exact<{
name: Scalars['String']['input'];
vin: Scalars['String']['input'];
}>;


export type CreateCarMutation = { __typename?: 'Mutation', createCar: { __typename?: 'CreateCarResponse', created: boolean } };

export type GetUserCarsQueryVariables = Exact<{
limit: Scalars['Int']['input'];
}>;
Expand Down Expand Up @@ -142,6 +166,13 @@ export const UserCarFragmentDoc = new TypedDocumentString(`
}
}
`, {"fragmentName":"UserCar"}) as unknown as TypedDocumentString<UserCarFragment, unknown>;
export const CreateCarDocument = new TypedDocumentString(`
mutation CreateCar($name: String!, $vin: String!) {
createCar(params: {name: $name, vin: $vin}) {
created
}
}
`) as unknown as TypedDocumentString<CreateCarMutation, CreateCarMutationVariables>;
export const GetUserCarsDocument = new TypedDocumentString(`
query GetUserCars($limit: Int!) {
getUserCars(params: {limit: $limit}) {
Expand Down
5 changes: 5 additions & 0 deletions graphql/CreateCar.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mutation CreateCar($name: String!, $vin: String!) {
createCar (params: { name: $name, vin: $vin }) {
created
}
}
Loading

0 comments on commit f989b29

Please sign in to comment.