Skip to content

Commit 443b4be

Browse files
committed
feat(post-info): deprecate slug field
1 parent dd3d98f commit 443b4be

7 files changed

Lines changed: 4 additions & 35 deletions

File tree

src/posts/notionRepository.test.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ test.beforeEach(async () => {
2626
tags: props.tags || [],
2727
id: props.id || '',
2828
date: new Date('2021-01-01'),
29-
slug: props.slug || '',
3029
tweet: props.tweet || '',
3130
imageUrl: props.imageUrl || '',
3231
imageAlt: props.imageAlt || '',
@@ -142,29 +141,6 @@ test('getPosts', async (t) => {
142141
end: null,
143142
},
144143
},
145-
Slug: {
146-
id: '%5B%3E%3Fn',
147-
type: 'rich_text',
148-
rich_text: [
149-
{
150-
type: 'text',
151-
text: {
152-
content: 'post-slug',
153-
link: null,
154-
},
155-
annotations: {
156-
bold: false,
157-
italic: false,
158-
strikethrough: false,
159-
underline: false,
160-
code: false,
161-
color: 'default',
162-
},
163-
plain_text: 'post-slug',
164-
href: null,
165-
},
166-
],
167-
},
168144
Tweet: {
169145
id: '%5B%3E%3Fn',
170146
type: 'rich_text',
@@ -252,7 +228,6 @@ test('getPosts', async (t) => {
252228
published: true,
253229
date: new Date(dateString),
254230
tags: ['tag1', 'tag2'],
255-
slug: 'post-slug',
256231
tweet: 'This is a tweet that brifely describes the post.',
257232
imageUrl: '/placeholder.png',
258233
imageAlt: 'Some image alt',

src/posts/notionRepository.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export class NotionRepository implements IPostRepository {
4848
{ propName: 'Tags', outputField: 'tags' },
4949
{ propName: 'Id', outputField: 'id' },
5050
{ propName: 'Date', outputField: 'date' },
51-
{ propName: 'Slug', outputField: 'slug' },
5251
{ propName: 'Tweet', outputField: 'tweet' },
5352
{ propName: 'ImageURL', outputField: 'imageUrl' },
5453
{ propName: 'ImageAlt', outputField: 'imageAlt' },

src/posts/postInfoEntity.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ class PostInfoEntity implements IPostInfo {
66
tags: string[];
77
id: string;
88
date: Date;
9-
slug: string;
109
tweet: string;
1110
imageUrl: string;
1211
imageAlt: string;
@@ -17,7 +16,6 @@ class PostInfoEntity implements IPostInfo {
1716
this.tags = props.tags || [];
1817
this.id = props.id || '';
1918
this.date = props.date || new Date();
20-
this.slug = props.slug || '';
2119
this.tweet = props.tweet || '';
2220
this.imageUrl = props.imageUrl || '';
2321
this.imageAlt = props.imageAlt || '';

src/posts/postService.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ test('getPosts', async (t) => {
3333
published: true,
3434
date: new Date(),
3535
tags: ['tag1', 'tag2'],
36-
slug: 'slug',
3736
tweet: 'this tweet is a short description of the post',
3837
imageUrl: 'https://image.com',
3938
imageAlt: 'image alt',

src/posts/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export interface IPostInfo {
44
published: boolean;
55
date: Date;
66
tags: string[];
7-
slug: string;
87
tweet: string;
98
imageUrl: string;
109
imageAlt: string;

src/rss/rssService.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ test('getRss', async (t) => {
3131
published: true,
3232
date: new Date(),
3333
tags: ['tag1', 'tag2'],
34-
slug: 'post-slug',
3534
tweet: 'this tweet is a short description of the post',
3635
imageUrl: 'https://image.com',
3736
imageAlt: 'image alt',
@@ -48,10 +47,10 @@ test('getRss', async (t) => {
4847
fakePosts[0].title
4948
}</title><pubDate>${fakePosts[0].date.toUTCString()}</pubDate><guid isPermaLink="true">${
5049
cfg.host
51-
}/${fakePosts[0].slug}/</guid><description><![CDATA[${
50+
}/${fakePosts[0].id}/</guid><description><![CDATA[${
5251
fakePosts[0].tweet
5352
}]]></description><link>${cfg.host}/${
54-
fakePosts[0].slug
53+
fakePosts[0].id
5554
}/</link></item></channel></rss>`;
5655

5756
fakeGetPosts.resolves(fakePosts);

src/rss/rssService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ export class RssService implements IRssService {
7474
{
7575
guid: [
7676
{ _attr: { isPermaLink: true } },
77-
`${this.cfg.host}/${post.slug}/`,
77+
`${this.cfg.host}/${post.id}/`,
7878
],
7979
},
8080
{ description: { _cdata: post.tweet } },
81-
{ link: `${this.cfg.host}/${post.slug}/` },
81+
{ link: `${this.cfg.host}/${post.id}/` },
8282
],
8383
};
8484
});

0 commit comments

Comments
 (0)