Permalink
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
atproto/packages/bsky/src/api/force-pull.ts /
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
40 lines (36 sloc)
1.15 KB
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
| import express from 'express' | |
| import AppContext from '../context' | |
| export const createRouter = (ctx: AppContext): express.Router => { | |
| const router = express.Router() | |
| router.post('/forcePull/:repo/:commit', async function (req, res) { | |
| const {repo, commit} = req.params; | |
| let err:unknown = null; | |
| await ctx.db.transaction(async (tx) => { | |
| try { | |
| const indexingTx = ctx.services.indexing(tx); | |
| const { root, commit: commitObj } = await indexingTx.indexRepo(repo, commit); | |
| await indexingTx.indexHandle(repo, new Date().toISOString()); | |
| await indexingTx.setCommitLastSeen(commitObj, | |
| {commit: root, rebase: false, tooBig: false} | |
| ); | |
| } catch (e) { | |
| console.log(e); | |
| err = e; | |
| } | |
| }); | |
| if (err) { | |
| res.status(400).send({}); | |
| return; | |
| } | |
| res.send({}); | |
| }) | |
| router.post('/fetchProfile/:repo', async function (req, res) { | |
| const {repo} = req.params; | |
| await ctx.db.transaction(async (tx) => { | |
| const indexingTx = ctx.services.indexing(tx); | |
| await indexingTx.indexHandle(repo, new Date().toISOString()); | |
| }); | |
| res.send({}); | |
| }) | |
| return router; | |
| } |