Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Luciano Barletta
/
message-service
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
1
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 203709fc
authored
2019-09-20 15:22:30 +0000
by
Luciano Barletta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added enums classification, not tested
1 parent
e7682beb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
45 deletions
database.py
enums.py
process_message.py
services.py
database.py
View file @
203709f
import
sqlite3
class
Table
:
id
=
"id"
file
=
"file"
serv
=
"serv"
dest
=
"dest"
type
=
"type"
state
=
"state"
class
States
:
queued
=
"queued"
delivered
=
"delivered"
from
enums
import
Table
,
States
,
Services
,
Datatypes
class
DBconnection
:
...
...
enums.py
0 → 100644
View file @
203709f
class
Table
:
id
=
"id"
file
=
"file"
serv
=
"serv"
dest
=
"dest"
type
=
"type"
state
=
"state"
class
States
:
queued
=
"queued"
delivered
=
"delivered"
class
Services
:
wpp1
=
"wpp1"
@staticmethod
def
validate
(
serv
):
if
serv
==
Services
.
wpp1
:
return
True
return
False
class
Datatypes
:
text
=
"text"
image
=
"image"
document
=
"document"
link
=
"link"
@staticmethod
def
validate
(
datatype
):
if
datatype
==
Datatypes
.
text
:
return
True
if
datatype
==
Datatypes
.
image
:
return
True
if
datatype
==
Datatypes
.
document
:
return
True
if
datatype
==
Datatypes
.
link
:
return
True
return
False
process_message.py
View file @
203709f
import
ipdb
import
os
from
services
import
serviceFactory
,
Datatypes
,
Services
from
database
import
DBconnection
,
Table
,
States
from
services
import
serviceFactory
from
database
import
DBconnection
from
enums
import
Services
,
States
,
Datatypes
,
Table
class
Process
:
...
...
services.py
View file @
203709f
import
requests
import
json
import
os
from
database
import
Table
from
enums
import
Table
,
Services
,
States
,
Datatypes
from
abc
import
ABC
,
abstractmethod
class
Services
:
wpp1
=
"wpp1"
@staticmethod
def
validate
(
serv
):
if
serv
==
Services
.
wpp1
:
return
True
return
False
# move this to be more accessible, everything needs to use it...
# or perhaps I can work around it
class
Datatypes
:
text
=
"text"
image
=
"image"
document
=
"document"
link
=
"link"
@staticmethod
def
validate
(
datatype
):
if
datatype
==
Datatypes
.
text
:
return
True
if
datatype
==
Datatypes
.
image
:
return
True
if
datatype
==
Datatypes
.
document
:
return
True
if
datatype
==
Datatypes
.
link
:
return
True
return
False
class
ServiceBase
(
ABC
):
@abstractmethod
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment