Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BambangShop Receiver App
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daffa Aqil Mahmud
BambangShop Receiver App
Commits
0e3b7954
Commit
0e3b7954
authored
1 month ago
by
noQils
Browse files
Options
Downloads
Patches
Plain Diff
Create Notification model struct.
parent
d6520cd9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/model/mod.rs
+2
-1
2 additions, 1 deletion
src/model/mod.rs
src/model/notification.rs
+31
-0
31 additions, 0 deletions
src/model/notification.rs
with
33 additions
and
1 deletion
src/model/mod.rs
+
2
−
1
View file @
0e3b7954
pub
mod
subscriber
;
\ No newline at end of file
pub
mod
subscriber
;
pub
mod
notification
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/model/notification.rs
0 → 100644
+
31
−
0
View file @
0e3b7954
use
std
::
fmt
::{
Display
,
Formatter
,
Result
};
use
rocket
::
serde
::{
Deserialize
,
Serialize
};
#[derive(Debug,
Clone,
Deserialize,
Serialize)]
#[serde(crate
=
"rocket::serde"
)]
pub
struct
Notification
{
pub
product_title
:
String
,
pub
product_url
:
String
,
pub
product_type
:
String
,
pub
subscriber_name
:
String
,
pub
status
:
String
}
impl
Display
for
Notification
{
fn
fmt
(
&
self
,
f
:
&
mut
Formatter
<
'_
>
)
->
Result
{
if
self
.status
.to_uppercase
()
.eq
(
"CREATED"
)
{
return
write!
(
f
,
"Hello {}, let's try our new {} product: {}, only in BambangShop! Check it out: {}"
,
self
.subscriber_name
,
self
.product_type
.to_lowercase
(),
self
.product_title
,
self
.product_url
);
}
else
if
self
.status
.to_uppercase
()
.eq
(
"DELETED"
)
{
return
write!
(
f
,
"Hello {}, we informed that our {} product called {} already sold out..."
,
self
.subscriber_name
,
self
.product_type
.to_lowercase
(),
self
.product_title
);
}
else
{
return
write!
(
f
,
"Hello {}, let's try our {} product: {}, grab it out before the stock ran out! Check it out: {}"
,
self
.subscriber_name
,
self
.product_type
.to_lowercase
(),
self
.product_title
,
self
.product_url
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment