2021-08-25 21:20:53 +00:00
|
|
|
from html2text import html2text
|
2021-08-20 09:27:19 +00:00
|
|
|
import datetime
|
|
|
|
|
2021-08-23 08:44:46 +00:00
|
|
|
# markdown = Converter()
|
2021-08-20 09:27:19 +00:00
|
|
|
|
|
|
|
def migrate(entry):
|
2021-08-23 08:44:46 +00:00
|
|
|
'''
|
2021-08-20 09:27:19 +00:00
|
|
|
# is comment
|
|
|
|
type Shout {
|
|
|
|
org: String!
|
2021-08-25 21:20:53 +00:00
|
|
|
slug: String
|
2021-08-20 09:27:19 +00:00
|
|
|
author: Int!
|
|
|
|
body: String!
|
|
|
|
createdAt: DateTime!
|
|
|
|
updatedAt: DateTime!
|
|
|
|
deletedAt: DateTime
|
|
|
|
deletedBy: Int
|
|
|
|
rating: Int
|
|
|
|
published: DateTime # if there is no published field - it is not published
|
|
|
|
replyTo: String # another shout
|
|
|
|
tags: [String] # actual values
|
|
|
|
topics: [String] # topic-slugs
|
|
|
|
title: String
|
|
|
|
versionOf: String
|
|
|
|
visibleForRoles: [String] # role ids are strings
|
|
|
|
visibleForUsers: [Int]
|
|
|
|
}
|
2021-08-23 08:44:46 +00:00
|
|
|
'''
|
2021-08-20 09:27:19 +00:00
|
|
|
# TODO: implement comments migration
|
|
|
|
return {
|
2021-08-25 21:20:53 +00:00
|
|
|
'org_id': 0,
|
2021-08-20 09:27:19 +00:00
|
|
|
'slug': entry['slug'],
|
|
|
|
'createdAt': entry['createdAt'],
|
2021-08-23 08:44:46 +00:00
|
|
|
'body': html2text(entry['body']),
|
2021-08-20 09:27:19 +00:00
|
|
|
'replyTo': entry['']
|
|
|
|
}
|