Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
Homework_89_Tsoy_Danil
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Цой Данил
Homework_89_Tsoy_Danil
Commits
8e96069a
Commit
8e96069a
authored
Mar 15, 2023
by
Цой Данил
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#2
checked albums for working
parent
a83985f5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
IAlbum.ts
src/interfaces/IAlbum.ts
+3
-3
IArtist.ts
src/interfaces/IArtist.ts
+4
-3
albumsService.ts
src/services/albumsService.ts
+1
-2
No files found.
src/interfaces/IAlbum.ts
View file @
8e96069a
import
{
Document
,
ObjectId
}
from
"mongoose"
import
{
Types
}
from
"mongoose"
;
import
IArtist
from
"./IArtist"
;
export
default
interface
IAlbum
extends
Document
{
_id
:
ObjectId
export
default
interface
IAlbum
{
_id
:
Types
.
ObjectId
title
:
string
;
artist
:
IArtist
[
'_id'
]
releaseYear
:
Date
...
...
src/interfaces/IArtist.ts
View file @
8e96069a
import
{
Document
,
ObjectId
}
from
"mongoose"
import
{
Types
}
from
"mongoose"
;
export
default
interface
IArtist
extends
Document
{
_id
:
ObjectId
export
default
interface
IArtist
{
_id
:
Types
.
ObjectId
name
:
string
;
photo
:
string
;
information
:
string
;
...
...
src/services/albumsService.ts
View file @
8e96069a
...
...
@@ -3,13 +3,12 @@ import IAlbum from "../interfaces/IAlbum";
import
IResponse
from
"../interfaces/IResponse"
;
import
IAlbumDto
from
"../interfaces/IAlbumDto"
;
import
{
Album
}
from
"../models/Album"
;
import
IArtist
from
"../interfaces/IArtist"
;
export
class
AlbumsService
{
public
getAlbums
=
async
():
Promise
<
IResponse
<
IAlbum
[]
|
null
>>
=>
{
try
{
const
data
=
await
Album
.
find
().
populate
(
'
A
rtist'
)
const
data
=
await
Album
.
find
().
populate
(
'
a
rtist'
)
const
response
:
IResponse
<
IAlbum
[]
>
=
{
status
:
EStatuses
.
SUCCESS
,
result
:
data
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment