Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
exam_12_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
Цой Данил
exam_12_Tsoy_Danil
Commits
3b428a77
Commit
3b428a77
authored
Apr 15, 2023
by
Цой Данил
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added fixtures file + filled it with data
parent
ffb02e6b
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
0 deletions
+79
-0
.gitignore
backend/public/uploads/.gitignore
+6
-0
aurelion_sol.jpg
backend/public/uploads/aurelion_sol.jpg
+0
-0
darius.jpg
backend/public/uploads/darius.jpg
+0
-0
dark_start_morde.jpg
backend/public/uploads/dark_start_morde.jpg
+0
-0
ledros.jpg
backend/public/uploads/ledros.jpg
+0
-0
quinn.jpg
backend/public/uploads/quinn.jpg
+0
-0
yi.jpg
backend/public/uploads/yi.jpg
+0
-0
fixtures.ts
backend/src/fixtures.ts
+73
-0
No files found.
backend/public/uploads/.gitignore
View file @
3b428a77
*
!.gitignore
!ledros.jpg
!aurelion_sol.jpg
!dark_start_morde.jpg
!quinn.jpg
!darius.jpg
!yi.jpg
\ No newline at end of file
backend/public/uploads/aurelion_sol.jpg
0 → 100644
View file @
3b428a77
196 KB
backend/public/uploads/darius.jpg
0 → 100644
View file @
3b428a77
This diff is collapsed.
Click to expand it.
backend/public/uploads/dark_start_morde.jpg
0 → 100644
View file @
3b428a77
This diff is collapsed.
Click to expand it.
backend/public/uploads/ledros.jpg
0 → 100644
View file @
3b428a77
This diff is collapsed.
Click to expand it.
backend/public/uploads/quinn.jpg
0 → 100644
View file @
3b428a77
This diff is collapsed.
Click to expand it.
backend/public/uploads/yi.jpg
0 → 100644
View file @
3b428a77
This diff is collapsed.
Click to expand it.
backend/src/fixtures.ts
View file @
3b428a77
import
dotenv
from
'dotenv'
import
mongoose
from
'mongoose'
import
{
User
}
from
'./models/User'
import
{
Photo
}
from
'./models/Photo'
dotenv
.
config
()
mongoose
.
connect
(
process
.
env
.
MONGO_CLIENT_URL
||
''
)
const
db
=
mongoose
.
connection
export
default
db
.
once
(
'open'
,
async
()
=>
{
try
{
await
db
.
dropCollection
(
'users'
)
await
db
.
dropCollection
(
'photos'
)
}
catch
(
err
:
unknown
){
console
.
log
(
`Skipped db drop because of:
${
err
}
`
);
}
const
[
userOne
,
userTwo
]
=
await
User
.
create
(
{
username
:
'user1'
,
password
:
'pass'
},
{
username
:
'user2'
,
password
:
'pass'
,
}
)
await
Photo
.
create
(
{
user
:
userOne
.
_id
,
title
:
'Darius'
,
photo
:
'darius.jpg'
},
{
user
:
userOne
.
_id
,
title
:
'Aurelion Sol'
,
photo
:
'aurelion_sol.jpg'
},
{
user
:
userTwo
.
_id
,
title
:
'Master Yi'
,
photo
:
'yi.jpg'
},
{
user
:
userOne
.
_id
,
title
:
'Commander Ledros'
,
photo
:
'ledros.jpg'
},
{
user
:
userOne
.
_id
,
title
:
'Commander Ledros'
,
photo
:
'ledros.jpg'
},
{
user
:
userTwo
.
_id
,
title
:
'Quinn and Valor'
,
photo
:
'quinn.jpg'
},
{
user
:
userTwo
.
_id
,
title
:
'Dark start Mordekaiser'
,
photo
:
'dark_start_morde.jpg'
}
)
db
.
close
()
})
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