Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hw92
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
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
Болатов Ален
hw92
Commits
0701dfb0
Commit
0701dfb0
authored
Apr 03, 2023
by
Болатов Ален
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '21' into 'dev'
some changes See merge request
!22
parents
4ba578d4
6e0a4fa8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
27 deletions
+37
-27
IPost.ts
backend/src/interfaces/IPost.ts
+8
-7
Post.ts
backend/src/models/Post.ts
+29
-20
No files found.
backend/src/interfaces/IPost.ts
View file @
0701dfb0
import
{
Document
,
ObjectId
}
from
"mongoose"
;
import
{
Document
,
ObjectId
}
from
'mongoose'
;
export
default
interface
IPost
extends
Document
{
_id
:
ObjectId
title
:
string
description
:
string
image
:
File
|
undefined
|
string
datetime
:
Date
}
\ No newline at end of file
_id
:
ObjectId
;
title
:
string
;
description
:
string
;
image
:
File
|
undefined
|
string
;
datetime
:
Date
;
user
:
ObjectId
;
}
backend/src/models/Post.ts
View file @
0701dfb0
import
mongoose
,
{
Schema
}
from
"mongoose"
;
import
IPost
from
"../interfaces/IPost"
;
import
mongoose
,
{
Schema
}
from
'mongoose'
;
import
IPost
from
'../interfaces/IPost'
;
const
PostsSchema
:
Schema
=
new
Schema
<
IPost
>
({
title
:
{
type
:
String
,
required
:
true
},
description
:
{
type
:
String
,
required
:
false
},
image
:
String
,
datetime
:
{
type
:
Date
,
default
:
Date
.
now
()
}
},
{
versionKey
:
false
})
const
PostsSchema
:
Schema
=
new
Schema
<
IPost
>
(
{
title
:
{
type
:
String
,
required
:
true
,
},
description
:
{
type
:
String
,
},
image
:
{
type
:
String
,
},
datetime
:
{
type
:
Date
,
default
:
Date
.
now
,
required
:
true
,
},
user
:
{
type
:
Schema
.
Types
.
ObjectId
,
required
:
true
,
},
},
{
versionKey
:
false
,
}
);
export
const
Post
=
mongoose
.
model
<
IPost
>
(
'Post'
,
PostsSchema
)
\ No newline at end of file
export
const
Post
=
mongoose
.
model
<
IPost
>
(
'Post'
,
PostsSchema
);
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