Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Feat/adc/search view v2 #358

Merged
merged 35 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
be926dc
feat(search): exchange between search bar and searchView. paella
AmauryDanisCousandier Dec 7, 2023
5d103c6
feat(search): proper data passing through handler
AmauryDanisCousandier Dec 7, 2023
11ed8f9
stupid hooks rules
AmauryDanisCousandier Dec 7, 2023
dac9849
bug fix
AmauryDanisCousandier Dec 7, 2023
b385364
t1
AmauryDanisCousandier Dec 21, 2023
5fc937d
wip
AmauryDanisCousandier Dec 22, 2023
88b1115
Merge branch 'main' into feat/adc/search-view-v2
AmauryDanisCousandier Jan 4, 2024
f2f7ec3
fixed a thing or two
AmauryDanisCousandier Jan 6, 2024
90f9574
merge main
AmauryDanisCousandier Jan 6, 2024
0ea8cb8
fix(searchViewV2): the fat of the land
AmauryDanisCousandier Jan 6, 2024
bb7a17f
feat(../V2/SearchView: copied working parts of music list
AmauryDanisCousandier Jan 7, 2024
3420991
feat(../V2/SearchView): wip
AmauryDanisCousandier Jan 7, 2024
3c9d71a
feat(../V2/SearchView): artist name retrieval
AmauryDanisCousandier Jan 7, 2024
1b1659f
fix(../V2/SearchView): key
AmauryDanisCousandier Jan 7, 2024
c7c9250
Merge branch 'main' into feat/adc/search-view-v2
AmauryDanisCousandier Jan 7, 2024
a33d56b
fix(searchview2): fix types and remove deprecated search components
AmauryDanisCousandier Jan 7, 2024
40f16ab
lint
AmauryDanisCousandier Jan 7, 2024
eb24511
style(../V2/SearchView): function name change
AmauryDanisCousandier Jan 8, 2024
9416393
Update SearchView.tsx var name
AmauryDanisCousandier Jan 8, 2024
7a2b877
feat(searchview2): wip
AmauryDanisCousandier Jan 8, 2024
29b2bed
wip
AmauryDanisCousandier Jan 9, 2024
934010a
tsc pretty lint
AmauryDanisCousandier Jan 9, 2024
caa3322
liked handled properly
AmauryDanisCousandier Jan 11, 2024
a69e5ac
fix artist name
AmauryDanisCousandier Jan 11, 2024
29a9ffc
pretty tsc lint
AmauryDanisCousandier Jan 11, 2024
3f0d0d5
like state
AmauryDanisCousandier Jan 12, 2024
627b8df
css fixed
AmauryDanisCousandier Jan 12, 2024
86b2c1b
histo
AmauryDanisCousandier Jan 12, 2024
fd60f2d
artist and genre keys to refetch without changing the query
AmauryDanisCousandier Jan 12, 2024
38110d2
merge dev NOT READY TO MERGE INTO MAIN
AmauryDanisCousandier Jan 12, 2024
131d7bf
Merge branch 'main' into feat/adc/search-view-v2
AmauryDanisCousandier Jan 13, 2024
f2ad34c
feat(search view v2): update API.searchSongs
AmauryDanisCousandier Jan 13, 2024
4ba4303
fix(../V2/SearchView): actual music list used + minor fixes
AmauryDanisCousandier Jan 14, 2024
a3893bd
yay
AmauryDanisCousandier Jan 14, 2024
d3c7e4a
Merge branch 'main' into feat/adc/search-view-v2
Octopus773 Jan 14, 2024
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
2 changes: 1 addition & 1 deletion back/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM node:17
FROM node:18.10.0
Arthi-chaud marked this conversation as resolved.
Show resolved Hide resolved
WORKDIR /app
CMD npm i ; npx prisma generate ; npx prisma migrate dev ; npm run start:dev
10,761 changes: 10,760 additions & 1 deletion back/package-lock.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion back/src/scores/scores.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get } from "@nestjs/common";
import { Controller, Get, Put } from "@nestjs/common";
import { ApiOkResponse, ApiTags } from "@nestjs/swagger";
import { ScoresService } from "./scores.service";
import { User } from "@prisma/client";
Expand All @@ -13,4 +13,10 @@ export class ScoresController {
getTopTwenty(): Promise<User[]> {
return this.scoresService.topTwenty();
}

Octopus773 marked this conversation as resolved.
Show resolved Hide resolved
// @ApiOkResponse{{description: "Successfully updated the user's total score"}}
// @Put("/add")
// addScore(): Promise<void> {
// return this.ScoresService.add()
// }
}
101 changes: 22 additions & 79 deletions front/API.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Artist, { ArtistHandler } from './models/Artist';
import Album from './models/Album';
import Chapter from './models/Chapter';
import Lesson from './models/Lesson';
import Genre, { GenreHandler } from './models/Genre';
Expand All @@ -24,6 +23,7 @@ import * as yup from 'yup';
import { base64ToBlob } from './utils/base64ToBlob';
import { ImagePickerAsset } from 'expo-image-picker';
import { SongCursorInfos, SongCursorInfosHandler } from './models/SongCursorInfos';
import { searchProps } from './views/V2/SearchView';

type AuthenticationInput = { username: string; password: string };
type RegistrationInput = AuthenticationInput & { email: string };
Expand Down Expand Up @@ -497,84 +497,6 @@ export default class API {
};
}

/**
* Search a song by its name
* @param query the string used to find the songs
*/
public static searchSongs(query: string): Query<Song[]> {
return {
key: ['search', 'song', query],
exec: () =>
API.fetch(
{
route: `/search/songs/${query}`,
},
{ handler: ListHandler(SongHandler) }
),
};
}

/**
* Search artists by name
* @param query the string used to find the artists
*/
public static searchArtists(query: string): Query<Artist[]> {
return {
key: ['search', 'artist', query],
exec: () =>
API.fetch(
{
route: `/search/artists/${query}`,
},
{ handler: ListHandler(ArtistHandler) }
),
};
}

/**
* Search Album by name
* @param query the string used to find the album
*/
public static searchAlbum(query: string): Query<Album[]> {
return {
key: ['search', 'album', query],
exec: async () => [
{
id: 1,
name: 'Super Trooper',
},
{
id: 2,
name: 'Kingdom Heart 365/2 OST',
},
{
id: 3,
name: 'The Legend Of Zelda Ocarina Of Time OST',
},
{
id: 4,
name: 'Random Access Memories',
},
],
};
}

/**
* Retrieve music genres
*/
public static searchGenres(query: string): Query<Genre[]> {
return {
key: ['search', 'genre', query],
exec: () =>
API.fetch(
{
route: `/search/genres/${query}`,
},
{ handler: ListHandler(GenreHandler) }
),
};
}

/**
* Retrieve a lesson
* @param lessonId the id to find the lesson
Expand Down Expand Up @@ -779,4 +701,25 @@ export default class API {
public static getPartitionSvgUrl(songId: number): string {
return `${API.baseUrl}/song/${songId}/assets/partition`;
}

public static searchSongs(query: searchProps): Query<Song[]> {
const queryParams: string[] = [];

if (query.artist) queryParams.push(`artistId=${query.artist}`);
if (query.genre) queryParams.push(`genreId=${query.genre}`);

const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';

return {
key: ['search', query.query],
exec: () => {
return API.fetch(
{
route: `/search/songs/${query.query}${queryString}`,
},
{ handler: ListHandler(SongHandler) }
);
},
};
}
}
2 changes: 1 addition & 1 deletion front/components/ScoreGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const Graph = ({ songId, since }: GraphProps) => {

const ScoreGraph = () => {
const layout = useWindowDimensions();
const songs = useQuery(API.getAllSongs);
const songs = useQuery(API.getAllSongs());
const rangeOptions = [
{ label: '3 derniers jours', value: '3days' },
{ label: 'Dernière semaine', value: 'week' },
Expand Down
119 changes: 0 additions & 119 deletions front/components/SearchBar.tsx

This file was deleted.

Loading