Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update backend to new endpoints and instance #239

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ xcodebuild/
*.xcscmblueprint
Breakpoints.xcbkptlist


# Sourcery generated file
animealTests/Sourcery/Generated/

#amplify-do-not-edit-begin
amplify/\#current-cloud-backend
amplify/.config/local-*
Expand All @@ -34,6 +38,3 @@ amplifytools.xcconfig
.secret-*
**.sample
#amplify-do-not-edit-end

# Sourcery generated file
animealTests/Sourcery/Generated/
168 changes: 168 additions & 0 deletions amplify/backend/api/animeal/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,146 @@ enum CategoryTag {
dogs
}

input PointInput {
type: String!
coordinates: [Float!]!
}

input FeedingPointI18nInput {
locale: String!
name: String
description: String
city: String
street: String
address: String
region: String
neighborhood: String
}


input CreateFeedingHistoryInput {
id: ID
userId: String!
images: [String!]!
createdAt: AWSDateTime
updatedAt: AWSDateTime
createdBy: String
updatedBy: String
owner: String
feedingPointId: String!
feedingPointDetails: FeedingPointDetailsInput
status: FeedingStatus
reason: String
moderatedBy: String
moderatedAt: AWSDateTime
assignedModerators: [String]
}

input UpdateFeedingHistoryInput {
id: ID!
userId: String
images: [String!]
createdAt: AWSDateTime
updatedAt: AWSDateTime
createdBy: String
updatedBy: String
owner: String
feedingPointId: String
feedingPointDetails: FeedingPointDetailsInput
status: FeedingStatus
reason: String
moderatedBy: String
moderatedAt: AWSDateTime
assignedModerators: [String]
}

input CreateFeedingPointInput {
id: ID
name: String!
description: String!
city: String!
street: String!
address: String!
images: [String!]
point: PointInput!
location: LocationInput!
region: String!
neighborhood: String!
distance: Float!
status: FeedingPointStatus!
i18n: [FeedingPointI18nInput!]
statusUpdatedAt: AWSDateTime!
createdAt: AWSDateTime
updatedAt: AWSDateTime
createdBy: String
updatedBy: String
owner: String
cover: String
feedingPointCategoryId: ID
}

input UpdateFeedingPointInput {
id: ID!
name: String
description: String
city: String
street: String
address: String
images: [String!]
point: PointInput
location: LocationInput
region: String
neighborhood: String
distance: Float
status: FeedingPointStatus
i18n: [FeedingPointI18nInput!]
statusUpdatedAt: AWSDateTime
createdAt: AWSDateTime
updatedAt: AWSDateTime
createdBy: String
updatedBy: String
owner: String
cover: String
feedingPointCategoryId: ID
}


input CreateFeedingInput {
id: ID
userId: String!
images: [String!]!
status: FeedingStatus!
createdAt: AWSDateTime
updatedAt: AWSDateTime
createdBy: String
updatedBy: String
owner: String
feedingPointDetails: FeedingPointDetailsInput
feedingPointFeedingsId: String!
expireAt: AWSTimestamp!
assignedModerators: [String]
moderatedBy: String
moderatedAt: AWSDateTime
}

input UpdateFeedingInput {
id: ID!
userId: String
images: [String!]
status: FeedingStatus
createdAt: AWSDateTime
updatedAt: AWSDateTime
createdBy: String
updatedBy: String
owner: String
feedingPointDetails: FeedingPointDetailsInput
feedingPointFeedingsId: String
expireAt: AWSTimestamp
assignedModerators: [String]
moderatedBy: String
moderatedAt: AWSDateTime
}


type FeedingPointDetails @aws_api_key @aws_cognito_user_pools {
address: String!
Expand Down Expand Up @@ -782,5 +922,33 @@ type Mutation {
@function(name: "rejectFeeding-${env}")
@aws_api_key
@aws_cognito_user_pools

createFeedingPointExt(input: CreateFeedingPointInput!): FeedingPoint @aws_api_key @aws_cognito_user_pools
updateFeedingPointExt(input: UpdateFeedingPointInput!): FeedingPoint @aws_api_key @aws_cognito_user_pools

createFeedingExt(input: CreateFeedingInput!): Feeding @aws_api_key @aws_cognito_user_pools
updateFeedingExt(input: UpdateFeedingInput!): Feeding @aws_api_key @aws_cognito_user_pools

createFeedingHistoryExt(input: CreateFeedingHistoryInput!): FeedingHistory @aws_api_key @aws_cognito_user_pools
updateFeedingHistoryExt(input: UpdateFeedingHistoryInput!): FeedingHistory @aws_api_key @aws_cognito_user_pools
}

type Subscription {
onUpdateFeedingExt: Feeding
@aws_subscribe(mutations: ["updateFeedingExt", "updateFeeding"]) @aws_api_key @aws_cognito_user_pools
onCreateFeedingExt: Feeding
@aws_subscribe(mutations: ["createFeedingExt", "createFeeding"]) @aws_api_key @aws_cognito_user_pools

onUpdateFeedingPointExt: FeedingPoint
@aws_subscribe(mutations: ["updateFeedingPointExt", "updateFeedingPoint"]) @aws_api_key @aws_cognito_user_pools
onCreateFeedingPointExt: FeedingPoint
@aws_subscribe(mutations: ["createFeedingPointExt", "createFeedingPoint"]) @aws_api_key @aws_cognito_user_pools

onUpdateFeedingHistoryExt: FeedingHistory
@aws_subscribe(mutations: ["updateFeedingHistoryExt", "updateFeedingHistory"]) @aws_api_key @aws_cognito_user_pools
onCreateFeedingHistoryExt: FeedingHistory
@aws_subscribe(mutations: ["createFeedingHistoryExt", "createFeedingHistory"]) @aws_api_key @aws_cognito_user_pools
}



90 changes: 90 additions & 0 deletions amplify/backend/backend-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,66 @@
}
},
"custom": {
"createFeedingExt": {
"dependsOn": [
{
"attributes": [
"GraphQLAPIKeyOutput",
"GraphQLAPIIdOutput",
"GraphQLAPIEndpointOutput"
],
"category": "api",
"resourceName": "animeal"
}
],
"providerPlugin": "awscloudformation",
"service": "customCDK"
},
"createFeedingPointExt": {
"dependsOn": [
{
"attributes": [
"GraphQLAPIKeyOutput",
"GraphQLAPIIdOutput",
"GraphQLAPIEndpointOutput"
],
"category": "api",
"resourceName": "animeal"
}
],
"providerPlugin": "awscloudformation",
"service": "customCDK"
},
"onCreateFeedingHistoryExt": {
"dependsOn": [
{
"attributes": [
"GraphQLAPIKeyOutput",
"GraphQLAPIIdOutput",
"GraphQLAPIEndpointOutput"
],
"category": "api",
"resourceName": "animeal"
}
],
"providerPlugin": "awscloudformation",
"service": "customCDK"
},
"onUpdateFeedingHistoryExt": {
"dependsOn": [
{
"attributes": [
"GraphQLAPIKeyOutput",
"GraphQLAPIIdOutput",
"GraphQLAPIEndpointOutput"
],
"category": "api",
"resourceName": "animeal"
}
],
"providerPlugin": "awscloudformation",
"service": "customCDK"
},
"searchByBounds": {
"dependsOn": [
{
Expand All @@ -172,6 +232,36 @@
],
"providerPlugin": "awscloudformation",
"service": "customCDK"
},
"updateFeedingExt": {
"dependsOn": [
{
"attributes": [
"GraphQLAPIKeyOutput",
"GraphQLAPIIdOutput",
"GraphQLAPIEndpointOutput"
],
"category": "api",
"resourceName": "animeal"
}
],
"providerPlugin": "awscloudformation",
"service": "customCDK"
},
"updateFeedingPointExt": {
"dependsOn": [
{
"attributes": [
"GraphQLAPIKeyOutput",
"GraphQLAPIIdOutput",
"GraphQLAPIEndpointOutput"
],
"category": "api",
"resourceName": "animeal"
}
],
"providerPlugin": "awscloudformation",
"service": "customCDK"
}
},
"function": {
Expand Down
1 change: 1 addition & 0 deletions amplify/backend/custom/createFeedingExt/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resolution-mode=highest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$util.toJson({"version":"2018-05-29","payload":{}})
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$util.toJson($ctx.args.input)

43 changes: 43 additions & 0 deletions amplify/backend/custom/createFeedingExt/cdk-stack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as cdk from '@aws-cdk/core';
import * as AmplifyHelpers from '@aws-amplify/cli-extensibility-helper';
import { AmplifyDependentResourcesAttributes } from '../../types/amplify-dependent-resources-ref';
import { Construct } from 'constructs';
import * as appsync from '@aws-cdk/aws-appsync';
import * as path from 'path';

export class cdkStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps, amplifyResourceProps?: AmplifyHelpers.AmplifyResourceProps) {
super(scope, id, props);
/* Do not remove - Amplify CLI automatically injects the current deployment environment in this input parameter */
new cdk.CfnParameter(this, 'env', {
type: 'String',
description: 'Current Amplify CLI env name',
});

// Access other Amplify Resources
const retVal: AmplifyDependentResourcesAttributes = AmplifyHelpers.addResourceDependency(
this,
amplifyResourceProps.category,
amplifyResourceProps.resourceName,
[
{
category: 'api',
resourceName: 'animeal',
},
],
);

const resolver = new appsync.CfnResolver(this, 'custom-resolver', {
apiId: cdk.Fn.ref(retVal.api.animeal.GraphQLAPIIdOutput),
fieldName: 'createFeedingExt',
typeName: 'Mutation', // Query | Mutation | Subscription
requestMappingTemplate: appsync.MappingTemplate.fromFile(
path.join(__dirname, '..', 'Mutation.createFeedingExt.req.vtl'),
).renderTemplate(),
responseMappingTemplate: appsync.MappingTemplate.fromFile(
path.join(__dirname, '..', 'Mutation.createFeedingExt.res.vtl'),
).renderTemplate(),
dataSourceName: 'NONE_DS',
});
}
}
Loading
Loading