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

chore: remove @googlemaps/google-maps-services-js dependency #334

Merged
merged 3 commits into from
Aug 14, 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
139 changes: 9 additions & 130 deletions .pnp.cjs

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

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
},
"homepage": "https://github.com/mbti-nf-team/unnamed-k-place-frontend#readme",
"dependencies": {
"@googlemaps/google-maps-services-js": "^3.3.42",
"@nf-team/core": "^2.0.3",
"@nf-team/react": "^2.6.0",
"@nf-team/storage": "^1.0.1",
Expand Down Expand Up @@ -72,7 +71,7 @@
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^14.0.0",
"@types/babel__core": "^7",
"@types/google.maps": "^3.55.8",
"@types/google.maps": "^3.55.12",
"@types/jest": "^29.5.5",
"@types/jest-plugin-context": "^2.9.5",
"@types/js-cookie": "^3.0.6",
Expand Down
7 changes: 2 additions & 5 deletions src/app/api/handler.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
Language, PlaceDetailsResponseData, PlacesNearbyResponseData, TextSearchResponseData,
} from '@googlemaps/google-maps-services-js';

import api, { paramsSerializer } from '@/lib/apis';
import { PlaceDetailsResponseData, PlacesNearbyResponseData, TextSearchResponseData } from '@/lib/types/google.maps';

import {
NaverSearchBlogResponse,
Expand Down Expand Up @@ -71,7 +68,7 @@ export const fetchAllPlaceDetails = async ({
const response = await Promise
.all([...placeIds.map((placeId) => getGooglePlaceDetails({
place_id: placeId,
language: Language.ko,
language: 'ko',
region: 'KR',
fields: ['name', 'photos', 'rating', 'user_ratings_total', 'formatted_address'],
reviews_no_translations: false,
Expand Down
5 changes: 1 addition & 4 deletions src/app/api/model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Language, PlaceType1 } from '@googlemaps/google-maps-services-js';

import { NaverSearchBlog } from '@/lib/types/blog';
import { Language } from '@/lib/types/google.maps';

export type TextSearchRequestParams = {
query: string;
Expand All @@ -12,7 +11,6 @@ export type TextSearchRequestParams = {
pagetoken?: string;
region?: string;
radius?: string;
type?: PlaceType1;
};

export type NearbySearchRequestParams = {
Expand All @@ -25,7 +23,6 @@ export type NearbySearchRequestParams = {
pagetoken?: string;
region?: string;
rankBy?: 'prominence' | 'distance';
type?: PlaceType1;
};

export type PlaceDetailsRequestParams = {
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/my/favorite-places/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function GET(request: NextRequest) {

const favoritePlaces = googleDetails.map((detail, index) => {
const placePhotoUrls = checkEmpty(detail.result.photos)
.map((photo) => getPlacePhotoUrl(photo.photo_reference, 500))
.map((photo) => getPlacePhotoUrl(photo.getUrl(), 500))
.filter((photoUrl) => !!photoUrl);

const favoritePlace = response.items[index];
Expand Down
3 changes: 1 addition & 2 deletions src/app/api/search/nearby/places/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NextRequest, NextResponse } from 'next/server';

import { Language } from '@googlemaps/google-maps-services-js';
import { checkEmpty } from '@nf-team/core';

import { fetchAllSettledSearchNaverBlogs, getGoogleNearbySearch } from '@/app/api/handler';
Expand Down Expand Up @@ -30,7 +29,7 @@ export async function GET(request: NextRequest) {
try {
const places = await getGoogleNearbySearch({
keyword: keyword ?? undefined,
language: Language.ko,
language: 'ko',
radius,
pagetoken: nextCursor ?? undefined,
location: [lat, lng],
Expand Down
7 changes: 2 additions & 5 deletions src/app/api/search/places/[placeId]/route.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { NextRequest, NextResponse } from 'next/server';

import {
Language, PlaceDetailsResponseData, PlaceType2,
} from '@googlemaps/google-maps-services-js';
import { checkEmpty } from '@nf-team/core';

import { fetchNaverSearchBlog, getGooglePlaceDetails, getPlacePhotoUrl } from '@/app/api/handler';
import { FetchError } from '@/lib/apis';
import { PlaceDetail } from '@/lib/types/google.maps';
import { PlaceDetail, PlaceDetailsResponseData, PlaceType2 } from '@/lib/types/google.maps';

export const runtime = 'edge';

Expand Down Expand Up @@ -45,7 +42,7 @@ export async function GET(request: NextRequest) {
try {
const placeDetails = await getGooglePlaceDetails({
place_id: placeId,
language: Language.ko,
language: 'ko',
region: 'KR',
reviews_sort: 'most_relevant',
fields: ['geometry', 'name', 'photos', 'place_id', 'rating', 'reviews', 'url', 'user_ratings_total', 'address_components'],
Expand Down
3 changes: 1 addition & 2 deletions src/app/api/search/places/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NextRequest, NextResponse } from 'next/server';

import { Language } from '@googlemaps/google-maps-services-js';
import { checkEmpty } from '@nf-team/core';

import { FetchError } from '@/lib/apis';
Expand Down Expand Up @@ -31,7 +30,7 @@ export async function GET(request: NextRequest) {
try {
const places = await getGoogleTextSearch({
query,
language: Language.ko,
language: 'ko',
opennow: false,
radius: radius ?? undefined,
pagetoken: nextCursor ?? undefined,
Expand Down
Loading
Loading