Skip to content

Commit

Permalink
refactor(controller): implement controllers using interface
Browse files Browse the repository at this point in the history
  • Loading branch information
sumitkolhe committed Mar 25, 2024
1 parent 17a26a0 commit 5fb3ef1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/modules/albums/controllers/album.controller.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { OpenAPIHono, createRoute, z } from '@hono/zod-openapi'
import type { Routes } from '#common/types'
import { AlbumService } from '#modules/albums/services'
import { AlbumModel } from '#modules/albums/models'

export class AlbumController {
export class AlbumController implements Routes {
public controller: OpenAPIHono
private albumService: AlbumService

Expand Down
3 changes: 2 additions & 1 deletion src/modules/artists/controllers/artist.controller.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { OpenAPIHono, createRoute } from '@hono/zod-openapi'
import { z } from 'zod'
import type { Routes } from '#common/types'
import { ArtistAlbumModel, ArtistModel, ArtistSongModel } from '#modules/artists/models'
import { ArtistService } from '#modules/artists/services'

export class ArtistController {
export class ArtistController implements Routes {
public controller: OpenAPIHono
private artistService: ArtistService

Expand Down
3 changes: 2 additions & 1 deletion src/modules/playlists/controllers/playlist.controller.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { OpenAPIHono, createRoute, z } from '@hono/zod-openapi'
import type { Routes } from '#common/types'
import { PlaylistService } from '#modules/playlists/services'
import { PlaylistModel } from '#modules/playlists/models'

export class PlaylistController {
export class PlaylistController implements Routes {
public controller: OpenAPIHono
private playlistService: PlaylistService

Expand Down
3 changes: 2 additions & 1 deletion src/modules/search/controllers/search.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { OpenAPIHono, createRoute, z } from '@hono/zod-openapi'
import type { Routes } from '#common/types'
import { SearchService } from '#modules/search/services'
import {
SearchAlbumModel,
Expand All @@ -8,7 +9,7 @@ import {
SearchSongModel
} from '#modules/search/models'

export class SearchController {
export class SearchController implements Routes {
public controller: OpenAPIHono
private searchService: SearchService

Expand Down

0 comments on commit 5fb3ef1

Please sign in to comment.