-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: resolve author name by user ID
- Loading branch information
Showing
7 changed files
with
72 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
export class PostDocument { | ||
static collectionName = 'posts'; | ||
|
||
export class NewPostDocument { | ||
message: string; | ||
date: number; | ||
author: string; | ||
} | ||
|
||
export class NewPostDocument { | ||
export class PostDocument extends NewPostDocument { | ||
static collectionName = 'posts'; | ||
|
||
message: string; | ||
date: number; | ||
userId: string; | ||
} | ||
|
||
export class PostDocumentResult { | ||
results: PostDocument[]; | ||
results: ResolvedPostDocument[]; | ||
nextPageToken?: number; | ||
} | ||
|
||
export class ResolvedPostDocument extends PostDocument { | ||
userName: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as firebase from 'firebase-admin'; | ||
|
||
export const getDisplayNameByUserId = async ( | ||
authorId: string, | ||
): Promise<string> => { | ||
return await firebase | ||
.auth() | ||
.getUser(authorId) | ||
.then(({ displayName }) => displayName); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters