Skip to content

Commit

Permalink
fix(server, web): project fetch failing (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyshx authored Jul 10, 2024
1 parent 9a5af7d commit f3aa237
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 29 deletions.
5 changes: 2 additions & 3 deletions server/internal/infrastructure/mongo/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import (
"fmt"
"regexp"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"

"github.com/reearth/reearth/server/internal/infrastructure/mongo/mongodoc"
"github.com/reearth/reearth/server/internal/usecase/repo"
"github.com/reearth/reearth/server/pkg/id"
Expand All @@ -16,6 +13,8 @@ import (
"github.com/reearth/reearthx/mongox"
"github.com/reearth/reearthx/rerror"
"github.com/reearth/reearthx/usecasex"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
)

var (
Expand Down
17 changes: 5 additions & 12 deletions server/internal/usecase/interactor/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ type Project struct {
file gateway.File
nlsLayerRepo repo.NLSLayer
layerStyles repo.Style
repos *repo.Container
}

func NewProject(r *repo.Container, gr *gateway.Container) interfaces.Project {
Expand Down Expand Up @@ -67,17 +66,11 @@ func (i *Project) Fetch(ctx context.Context, ids []id.ProjectID, _ *usecase.Oper
}

func (i *Project) FindByWorkspace(ctx context.Context, id accountdomain.WorkspaceID, keyword *string, sort *project.SortType, p *usecasex.Pagination, operator *usecase.Operator) ([]*project.Project, *usecasex.PageInfo, error) {
return Run2(
ctx, operator, i.repos,
Usecase().WithReadableWorkspaces(id),
func(ctx context.Context) ([]*project.Project, *usecasex.PageInfo, error) {
return i.repos.Project.FindByWorkspace(ctx, id, repo.ProjectFilter{
Sort: sort,
Keyword: keyword,
Pagination: p,
})
},
)
return i.projectRepo.FindByWorkspace(ctx, id, repo.ProjectFilter{
Pagination: p,
Sort: sort,
Keyword: keyword,
})
}

func (i *Project) Create(ctx context.Context, p interfaces.CreateProjectParam, operator *usecase.Operator) (_ *project.Project, err error) {
Expand Down
8 changes: 4 additions & 4 deletions web/src/services/gql/__gen__/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const documents = {
"\n fragment NLSLayerCommon on NLSLayer {\n id\n layerType\n sceneId\n config\n title\n visible\n infobox {\n sceneId\n layerId\n propertyId\n property {\n id\n ...PropertyFragment\n }\n blocks {\n id\n pluginId\n extensionId\n propertyId\n property {\n id\n ...PropertyFragment\n }\n }\n }\n isSketch\n sketch {\n customPropertySchema\n featureCollection {\n type\n features {\n ...FeatureFragment\n }\n }\n }\n ... on NLSLayerGroup {\n children {\n id\n }\n }\n }\n": types.NlsLayerCommonFragmentDoc,
"\n fragment NLSLayerStyle on Style {\n id\n name\n value\n }\n": types.NlsLayerStyleFragmentDoc,
"\n fragment PluginFragment on Plugin {\n id\n name\n extensions {\n extensionId\n description\n name\n translatedDescription(lang: $lang)\n translatedName(lang: $lang)\n icon\n singleOnly\n type\n widgetLayout {\n extendable {\n vertically\n horizontally\n }\n extended\n floating\n defaultLocation {\n zone\n section\n area\n }\n }\n }\n }\n": types.PluginFragmentFragmentDoc,
"\n fragment ProjectFragment on Project {\n id\n name\n description\n imageUrl\n isArchived\n isBasicAuthActive\n basicAuthUsername\n basicAuthPassword\n publicTitle\n publicDescription\n publicImage\n alias\n enableGa\n trackingId\n publishmentStatus\n updatedAt\n createdAt\n coreSupport\n }\n": types.ProjectFragmentFragmentDoc,
"\n fragment ProjectFragment on Project {\n id\n name\n description\n imageUrl\n isArchived\n isBasicAuthActive\n basicAuthUsername\n basicAuthPassword\n publicTitle\n publicDescription\n publicImage\n alias\n enableGa\n trackingId\n publishmentStatus\n updatedAt\n createdAt\n coreSupport\n starred\n }\n": types.ProjectFragmentFragmentDoc,
"\n fragment PropertySchemaFieldFragment on PropertySchemaField {\n fieldId\n title\n description\n translatedTitle(lang: $lang)\n translatedDescription(lang: $lang)\n prefix\n suffix\n type\n defaultValue\n ui\n min\n max\n choices {\n key\n icon\n title\n translatedTitle(lang: $lang)\n }\n isAvailableIf {\n fieldId\n type\n value\n }\n }\n\n fragment PropertySchemaGroupFragment on PropertySchemaGroup {\n schemaGroupId\n title\n collection\n translatedTitle(lang: $lang)\n isList\n representativeFieldId\n isAvailableIf {\n fieldId\n type\n value\n }\n fields {\n ...PropertySchemaFieldFragment\n }\n }\n\n fragment PropertyFieldFragment on PropertyField {\n id\n fieldId\n type\n value\n links {\n ...PropertyFieldLink\n }\n }\n\n fragment PropertyGroupFragment on PropertyGroup {\n id\n schemaGroupId\n fields {\n ...PropertyFieldFragment\n }\n }\n\n fragment PropertyItemFragment on PropertyItem {\n ... on PropertyGroupList {\n id\n schemaGroupId\n groups {\n ...PropertyGroupFragment\n }\n }\n ... on PropertyGroup {\n ...PropertyGroupFragment\n }\n }\n\n fragment PropertyFragmentWithoutSchema on Property {\n id\n items {\n ...PropertyItemFragment\n }\n }\n\n fragment PropertyFragment on Property {\n id\n ...PropertyFragmentWithoutSchema\n schema {\n id\n groups {\n ...PropertySchemaGroupFragment\n }\n }\n }\n\n fragment MergedPropertyGroupCommonFragment on MergedPropertyGroup {\n schemaGroupId\n fields {\n fieldId\n type\n actualValue\n overridden\n links {\n ...PropertyFieldLink\n }\n }\n }\n\n fragment MergedPropertyGroupFragment on MergedPropertyGroup {\n ...MergedPropertyGroupCommonFragment\n groups {\n ...MergedPropertyGroupCommonFragment\n }\n }\n\n fragment MergedPropertyFragmentWithoutSchema on MergedProperty {\n originalId\n parentId\n linkedDatasetId\n groups {\n ...MergedPropertyGroupFragment\n }\n }\n\n fragment MergedPropertyFragment on MergedProperty {\n ...MergedPropertyFragmentWithoutSchema\n schema {\n id\n }\n }\n\n fragment PropertyFieldLink on PropertyFieldLink {\n datasetId\n datasetSchemaId\n datasetSchemaFieldId\n }\n": types.PropertySchemaFieldFragmentFragmentDoc,
"\n fragment StoryFragment on Story {\n id\n title\n panelPosition\n bgColor\n isBasicAuthActive\n basicAuthUsername\n basicAuthPassword\n alias\n publicTitle\n publicDescription\n publishmentStatus\n publicImage\n publicNoIndex\n pages {\n ...StoryPageFragment\n }\n }\n": types.StoryFragmentFragmentDoc,
"\n fragment StoryPageFragment on StoryPage {\n id\n title\n swipeable\n propertyId\n property {\n id\n ...PropertyFragment\n }\n layersIds\n blocks {\n id\n pluginId\n extensionId\n property {\n id\n ...PropertyFragment\n }\n }\n }\n": types.StoryPageFragmentFragmentDoc,
Expand All @@ -48,7 +48,7 @@ const documents = {
"\n mutation UploadPlugin($sceneId: ID!, $file: Upload, $url: URL) {\n uploadPlugin(input: { sceneId: $sceneId, file: $file, url: $url }) {\n plugin {\n id\n name\n version\n description\n author\n }\n scenePlugin {\n pluginId\n propertyId\n }\n }\n }\n": types.UploadPluginDocument,
"\n mutation UninstallPlugin($sceneId: ID!, $pluginId: ID!) {\n uninstallPlugin(input: { sceneId: $sceneId, pluginId: $pluginId }) {\n pluginId\n }\n }\n": types.UninstallPluginDocument,
"\n query GetProject($projectId: ID!) {\n node(id: $projectId, type: PROJECT) {\n id\n ... on Project {\n ...ProjectFragment\n scene {\n id\n }\n }\n }\n }\n": types.GetProjectDocument,
"\n query GetProjects($teamId: ID!, $first: Int, $last: Int, $after: Cursor, $before: Cursor) {\n projects(teamId: $teamId, first: $first, last: $last, after: $after, before: $before) {\n edges {\n node {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n }\n nodes {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n totalCount\n }\n }\n\n\n": types.GetProjectsDocument,
"\n query GetProjects($teamId: ID!, $first: Int, $last: Int, $after: Cursor, $before: Cursor, $keyword: String, $sort: ProjectSortType) {\n projects(teamId: $teamId, first: $first, last: $last, after: $after, before: $before, keyword: $keyword, sort: $sort) {\n edges {\n node {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n }\n nodes {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n totalCount\n }\n }\n\n\n": types.GetProjectsDocument,
"\n query CheckProjectAlias($alias: String!) {\n checkProjectAlias(alias: $alias) {\n alias\n available\n }\n }\n": types.CheckProjectAliasDocument,
"\n mutation CreateProject(\n $teamId: ID!\n $visualizer: Visualizer!\n $name: String!\n $description: String!\n $imageUrl: URL\n $coreSupport: Boolean\n ) {\n createProject(\n input: {\n teamId: $teamId\n visualizer: $visualizer\n name: $name\n description: $description\n imageUrl: $imageUrl\n coreSupport: $coreSupport\n }\n ) {\n project {\n id\n name\n description\n imageUrl\n coreSupport\n }\n }\n }\n": types.CreateProjectDocument,
"\n mutation UpdateProject(\n $projectId: ID!\n $name: String\n $description: String\n $imageUrl: URL\n $publicTitle: String\n $publicDescription: String\n $publicImage: String\n $deleteImageUrl: Boolean\n $deletePublicImage: Boolean\n $enableGa: Boolean\n $trackingId: String\n ) {\n updateProject(\n input: {\n projectId: $projectId\n name: $name\n description: $description\n imageUrl: $imageUrl\n publicTitle: $publicTitle\n publicDescription: $publicDescription\n publicImage: $publicImage\n deleteImageUrl: $deleteImageUrl\n deletePublicImage: $deletePublicImage\n enableGa: $enableGa\n trackingId: $trackingId\n }\n ) {\n project {\n id\n ...ProjectFragment\n }\n }\n }\n\n": types.UpdateProjectDocument,
Expand Down Expand Up @@ -142,7 +142,7 @@ export function gql(source: "\n fragment PluginFragment on Plugin {\n id\n
/**
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function gql(source: "\n fragment ProjectFragment on Project {\n id\n name\n description\n imageUrl\n isArchived\n isBasicAuthActive\n basicAuthUsername\n basicAuthPassword\n publicTitle\n publicDescription\n publicImage\n alias\n enableGa\n trackingId\n publishmentStatus\n updatedAt\n createdAt\n coreSupport\n }\n"): (typeof documents)["\n fragment ProjectFragment on Project {\n id\n name\n description\n imageUrl\n isArchived\n isBasicAuthActive\n basicAuthUsername\n basicAuthPassword\n publicTitle\n publicDescription\n publicImage\n alias\n enableGa\n trackingId\n publishmentStatus\n updatedAt\n createdAt\n coreSupport\n }\n"];
export function gql(source: "\n fragment ProjectFragment on Project {\n id\n name\n description\n imageUrl\n isArchived\n isBasicAuthActive\n basicAuthUsername\n basicAuthPassword\n publicTitle\n publicDescription\n publicImage\n alias\n enableGa\n trackingId\n publishmentStatus\n updatedAt\n createdAt\n coreSupport\n starred\n }\n"): (typeof documents)["\n fragment ProjectFragment on Project {\n id\n name\n description\n imageUrl\n isArchived\n isBasicAuthActive\n basicAuthUsername\n basicAuthPassword\n publicTitle\n publicDescription\n publicImage\n alias\n enableGa\n trackingId\n publishmentStatus\n updatedAt\n createdAt\n coreSupport\n starred\n }\n"];
/**
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down Expand Up @@ -242,7 +242,7 @@ export function gql(source: "\n query GetProject($projectId: ID!) {\n node(i
/**
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function gql(source: "\n query GetProjects($teamId: ID!, $first: Int, $last: Int, $after: Cursor, $before: Cursor) {\n projects(teamId: $teamId, first: $first, last: $last, after: $after, before: $before) {\n edges {\n node {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n }\n nodes {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n totalCount\n }\n }\n\n\n"): (typeof documents)["\n query GetProjects($teamId: ID!, $first: Int, $last: Int, $after: Cursor, $before: Cursor) {\n projects(teamId: $teamId, first: $first, last: $last, after: $after, before: $before) {\n edges {\n node {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n }\n nodes {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n totalCount\n }\n }\n\n\n"];
export function gql(source: "\n query GetProjects($teamId: ID!, $first: Int, $last: Int, $after: Cursor, $before: Cursor, $keyword: String, $sort: ProjectSortType) {\n projects(teamId: $teamId, first: $first, last: $last, after: $after, before: $before, keyword: $keyword, sort: $sort) {\n edges {\n node {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n }\n nodes {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n totalCount\n }\n }\n\n\n"): (typeof documents)["\n query GetProjects($teamId: ID!, $first: Int, $last: Int, $after: Cursor, $before: Cursor, $keyword: String, $sort: ProjectSortType) {\n projects(teamId: $teamId, first: $first, last: $last, after: $after, before: $before, keyword: $keyword, sort: $sort) {\n edges {\n node {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n }\n nodes {\n id\n ...ProjectFragment\n scene {\n id\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n totalCount\n }\n }\n\n\n"];
/**
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
Loading

0 comments on commit f3aa237

Please sign in to comment.